text:
#ifndef CQWidgetMenu_H
#define CQWidgetMenu_H

#include <QWidget>
#include <QWidgetAction>
#include <QMenu>

/*!
  \ingroup CQWidgetMenu

  \brief Creates a menu containing a widget

  The CQWidgetMenu class provides a popup menu which can hold a fixed sized widget.

  To use create a CQWidgetMenu widget and a contents widget and use the setWidget()
  method to store the widget in the menu. The menu uses the contents widget's
  sizeHint to determine the menu size.
*/

class CQWidgetMenuAction;
class CQWidgetMenuArea;

/*!
  \ingroup CQWidgetMenu

  \brief Widget menu

  Widget Menu class.

  To use:
    . create a CQWidgetMenu widget
    . create a custom contents widget
    . Call setWidget to passing the contents widget
*/
class CQWidgetMenu : public QMenu {
  Q_OBJECT

 public:
  //! create menu
  CQWidgetMenu(QWidget *parent=nullptr);

  //! get menu action
  CQWidgetMenuAction *getAction() const;

  //! set contents widget
  void setWidget(QWidget *widget);

  //! create menu action
  virtual CQWidgetMenuAction *createAction();

  //! create area widget
  virtual CQWidgetMenuArea *createArea() const;

  //! reset menu size
  void resetSize();

  void updateAreaSize();

  void paintEvent(QPaintEvent *) override;

  QSize sizeHint() const override;

 signals:
  //! signal emitted before menu is shown
  void menuShown();

  //! signal emitted after menu is hidden
  void menuHidden();

 protected:
  CQWidgetMenuAction *action_ { nullptr }; // menu action widget
};

/*!
  \ingroup CQWidgetMenu

  \brief Widget menu area

  The widget menu area contains the area widget (to hold content widget)

  Internal class - DO NOT USE
*/
class CQWidgetMenuArea : public QWidget {
  Q_OBJECT

 public:
  //! create menu area
  CQWidgetMenuArea(QWidget *parent=nullptr);

  //! delete menu area
  virtual ~CQWidgetMenuArea() { }

  //! set contents widget
  virtual void setWidget(QWidget *w);

  //! get area widget
  QWidget *getWidget() const { return areaWidget_; }

  //! get menu action
  CQWidgetMenuAction *getAction() const { return action_; }

  //! set menu action
  void setAction(CQWidgetMenuAction *action);

  //! set menu size
  virtual void setSize(int w, int h);

  //! reset menu size
  virtual void resetSize();

  //! return size hint
  QSize sizeHint() const override;

  //! update widget placement in menu
  virtual void updateLayout();

  //! handle menu shown
  virtual void menuShow();

  //! handle menu hidden
  virtual void menuHide();

 private:
  //! handle resize event
  void resizeEvent(QResizeEvent *) override;

 private slots:
  //! handle menu shown signal
  void menuShowSlot();

  //! handle menu hidden signal
  void menuHideSlot();

 signals:
  //! notify menu shown
  void menuShown();

  //! notify menu hidden
  void menuHidden();

 protected:
  CQWidgetMenuAction *action_     { nullptr }; // menu action widget
  int                 w_ { 0 }, h_ { 0 };      // current width/height
  QWidget            *area_       { nullptr }; // container widget for content widget
  QWidget            *areaWidget_ { nullptr }; // content widget
};

/*!
  \ingroup CQWidgetMenu

  \brief Menu action widget

  Widget action to interface between widget contents and menu API

  Internal class - DO NOT USE
*/
class CQWidgetMenuAction : public QWidgetAction {
 public:
  CQWidgetMenuAction(CQWidgetMenu *menu);

 ~CQWidgetMenuAction();

  //! get parent menu
  CQWidgetMenu *getMenu() const { return menu_; }

  //! get menu contents area
  CQWidgetMenuArea *getArea() const;

  //! get menu content widget (required implementation for QWidgetAction)
  QWidget *getWidget() const;

 private:
  //! create menu widget (required implementation for QWidgetAction)
  QWidget *createWidget(QWidget *parent);

 protected:
  CQWidgetMenu     *menu_ { nullptr }; //! parent menu
  CQWidgetMenuArea *area_ { nullptr }; //! menu contents area
};

#endif


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>identical duplicate data items</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Upgrade Guide" />
    <link rel="up" href="upgrade_3_1_toc.html" title="Chapter 13. Upgrading Berkeley DB 3.0 applications to Berkeley DB 3.1" />
    <link rel="prev" href="upgrade_3_1_put.html" title="DB->put" />
    <link rel="next" href="upgrade_3_1_btstat.html" title="DB->stat" />

Library Version 11.2.5.3

          identical duplicate data items

          Prev
          Chapter 13. Upgrading Berkeley DB 3.0 applications to Berkeley DB 3.1
           Next

identical duplicate data items

In previous releases of Berkeley DB, it was not an error to store identical
duplicate data items, or, for those that just like the way it sounds,
duplicate duplicates.  However, there were implementation bugs where
storing duplicate duplicates could cause database corruption.

In this release, applications may store identical duplicate data items
as long as the data items are unsorted.  It is an error to attempt to
store identical duplicate data items when duplicates are being stored
in a sorted order. This restriction is expected to be lifted in a future
release.  See Duplicate data items for more information.

          Prev

            Up

           Next

          DB->put

            Home

           DB->stat

redpajama_set_name: RedPajamaGithub


text:
package org.d2rq.db;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.d2rq.D2RQException;

/**
 * Reads SQL statements from a file or other source.
 *
 * Statements must end with semicolon and must end
 * at the end of a line. Lines starting
 * with -- are considered comments and are ignored.
 */
public class SQLScriptLoader {
	private final static Log log = LogFactory.getLog(SQLScriptLoader.class);

	/**
	 * Loads a SQL script from a file and executes it.
	 */
	public static void loadFile(File file, Connection conn) {
		try {
			log.info("Reading SQL script from " + file);
			new SQLScriptLoader(new InputStreamReader(
					new FileInputStream(file), "utf-8"), conn).execute();
		} catch (UnsupportedEncodingException ex) {
			// UTF-8 is always supported
		} catch (IOException ex) {
			throw new D2RQException(
					"Error accessing SQL startup script " + file + ": " + ex.getMessage(),
					D2RQException.STARTUP_SQL_SCRIPT_ACCESS);
		}
	}

	/**
	 * Loads a SQL script from a URL and executes it.
	 */
	public static void loadURI(URI url, Connection conn) {
		try {
			log.info("Reading SQL script from <" + url + ">");
			new SQLScriptLoader(new InputStreamReader(
					url.toURL().openStream(), "utf-8"), conn).execute();
		} catch (UnsupportedEncodingException ex) {
			// UTF-8 is always supported
		} catch (IOException ex) {
			throw new D2RQException(
					"Error accessing SQL startup script <" + url + ">: " + ex.getMessage(),
					D2RQException.STARTUP_SQL_SCRIPT_ACCESS);
		}
	}
	private final BufferedReader in;
	private final Connection conn;

	public SQLScriptLoader(Reader in, Connection conn) {
		this.in = new BufferedReader(in);
		this.conn = conn;
	}

	public void execute() {
		int lineNumber = 1;
		int statements = 0;
		try {
			Statement stmt = conn.createStatement();
			try {
				String line;
				StringBuilder sql = new StringBuilder();
				while ((line = in.readLine()) != null) {
					if (line.trim().startsWith("--")) {
						// comment, ignore this line
					} else {
						if (line.trim().endsWith(";")) {
							sql.append(line.substring(0, line.length() -1));
							String s = sql.toString().trim();
							if (!"".equals(s)) {
								stmt.execute(s);
								statements++;
							}
							sql = new StringBuilder();
						} else {
							sql.append(line);
							sql.append('\n');
						}
					}
					lineNumber++;
				}
				String s = sql.toString().trim();
				if (!"".equals(s)) {
					stmt.execute(s);
				}
				log.info("Done, " + (lineNumber - 1) + " lines, " + statements + " statements");
			} catch (SQLException ex) {
				throw new SQLException(
						"in line " + lineNumber + ": " + ex.getMessage(), ex);
			} finally {
				stmt.close();
			}
		} catch (SQLException ex) {
			throw new D2RQException(ex, D2RQException.D2RQ_SQLEXCEPTION);
		} catch (IOException ex) {
			throw new RuntimeException(ex);
		}
	}
}


text:
<?php

namespace CurrencyCloud\Exception;

class InternalApplicationException extends ApiException
{

}


text:
            Templates

          <input type="text" class="b-search-input" ng-model="searchTemplate" ng-init="searchTemplate=''" id="js-search"
                 placeholder="Search...">

							{{ template.name }}

              <form
                  ng-submit="environmentSimpleViewCtrl.addSettingsToTemplate(templateSettings, environmentViewCtrl.containersTypeInfo[templateSettings.quotaSize])">

Container hostname

                    <input type="text" ng-focus="onTextFocus($event)"
                           id="js-container-name"
                           class="b-form-input b-form-input_full"
                           maxlength="50"
                           ng-model="templateSettings.containerName" required>

Select quota size

                    <select class="b-form-input b-form-input_full"
                            id="js-container-size"
                            ng-init="templateSettings.quotaSize = 'TINY'"
                            ng-model="templateSettings.quotaSize"
                    >
                      <option
                          ng-repeat="type in environmentViewCtrl.containersType"
                          value="{{ type }}" title="{{ environmentViewCtrl.containersTypeInfo[type] }}">
                        {{ type }}
                      </option>
                    </select>

                  <button type="submit" class="b-btn b-btn_green">Save</button>

              </form>

                {{ templateSettings.quotaSize }}:

									{{ key }}: {{ value }}

CUSTOM:

                cpu (%):
                <input type="number"
                       id="js-quotasize-custom-cpu"
                       class="b-form-input b-form-input_custom-quota"
                       ng-model="templateSettings.cpuQuota" required>

                ram (MB):
                <input type="number"
                       id="js-quotasize-custom-ram"
                       class="b-form-input b-form-input_custom-quota"
                       ng-model="templateSettings.ramQuota" required>

                disk (GB):
                <input type="number"
                       id="js-quotasize-custom-disk"
                       class="b-form-input b-form-input_custom-quota"
                       ng-model="templateSettings.diskQuota" required>

          <button class="b-btn b-btn_white"
                  ng-click="environmentSimpleViewCtrl.clearWorkspace()">
            Clear
          </button>
          <button
              class="b-btn b-btn_green"
              ng-if="!environmentSimpleViewCtrl.isEditing"
              ng-click="environmentSimpleViewCtrl.buildEnvironmentByJoint()">
            Apply
          </button>
          <button
              class="b-btn b-btn_green"
              ng-if="environmentSimpleViewCtrl.isEditing"
              ng-click="environmentSimpleViewCtrl.notifyChanges()">
            Apply
          </button>

            Name
            SSH Key
            Containers
            Actions

 0"
              ng-repeat="(key, environment) in environmentViewCtrl.environments">

              <a tooltips
                 ui-sref="containers({ environmentId: environment.id })"
                 tooltip-template='ID: {{ environment.id }}. Source: {{ environment.dataSource }}'
                 tooltip-side="right"
                 env-data-source="{{ environment.dataSource }}"
              >
                {{ environment.name }}

            Add/
              Remove

									{{value.quantity}}


text:
namespace Pong
{
	struct Font
	{
		enum Asset
		{
			forward
		};

		static std::string get_path(Asset type)
		{
			std::string base = get_assets_path();

			switch (type)
			{
			case forward: return base + "FFFFORWA.TTF";
			default: return "";
			}
		}
	};
}


text:
1. [bioinformatics](https://en.wikipedia.org/wiki/FASTA_format) and [DNA analysis](http://pythonforbiologists.com/index.php/introduction-to-python-for-biologists/regular-expressions/)
2. conversational assistants (Siri, Google Now)
3. Telephone Airline Reservation Systems
4. Chat Bots
5. MMORPG Chat Chaperoning
6. Web Search
7. Document Search/Indexing
8. Sports Reporting
9. Financial Market Reporting
10. [Forensic Linguistics (Authorship Attribution)](http://www.slideshare.net/PyData/authorship-attribution-forensic-linguistics-with-python-scikit-learn-pandas-kostas-perifanos)
10. Literature Analysis (Shakespeare Authorship, Historical Social Norms)
11. [Plagerism Detection](https://www.academia.edu/9984589/PLAGIARISM_DETECTION_ALGORITHM_USING_NATURAL_LANGUAGE_PROCESSING_BASED_ON_GRAMMAR_ANALYZING)
12. [Python Pattern and Anti-pattern Classification](https://www.quantifiedcode.com/knowledge-base/#python)
13. NOAA Weather Reports
14. Road Condition Reporting
15. [Online Customer Service](http://dl.acm.org/citation.cfm?id=1643823.1643908)
16. Spelling and Grammar Correction
17. Smartphone Keyboard Entry Prediction
18. [Machine Translation](http://www.hutchinsweb.me.uk/Nutshell-2005.pdf)_


text:
package t3.site.gitlab.merge;

import com.fasterxml.jackson.annotation.*;
import org.joda.time.DateTime;

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

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "upvotes",
    "iid",
    "description",
    "created_at",
    "title",
    "source_branch",
    "subscribed",
    "updated_at",
    "project_id",
    "merge_commit_sha",
    "id",
    "state",
    "work_in_progress",
    "author",
    "target_branch",
    "source_project_id",
    "downvotes",
    "should_remove_source_branch",
    "sha",
    "labels",
    "milestone",
    "web_url",
    "merge_status",
    "merge_when_build_succeeds",
    "user_notes_count",
    "assignee",
    "target_project_id",
    "force_remove_source_branch"
})
public class MergeRequest {

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("upvotes")
    private Integer upvotes;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("iid")
    private Integer iid;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("description")
    private String description;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("created_at")
    private DateTime createdAt;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("title")
    private String title;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_branch")
    private String sourceBranch;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("subscribed")
    private Boolean subscribed;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("updated_at")
    private String updatedAt;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("project_id")
    private Integer projectId;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_commit_sha")
    private String mergeCommitSha;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("id")
    private Integer id;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("state")
    private String state;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("work_in_progress")
    private Boolean workInProgress;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("author")
    private Author author;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_branch")
    private String targetBranch;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_project_id")
    private Integer sourceProjectId;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("downvotes")
    private Integer downvotes;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("should_remove_source_branch")
    private Object shouldRemoveSourceBranch;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("sha")
    private String sha;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("labels")
    private List<Object> labels = null;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("milestone")
    private Object milestone;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("web_url")
    private String webUrl;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_status")
    private String mergeStatus;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_when_build_succeeds")
    private Boolean mergeWhenBuildSucceeds;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("user_notes_count")
    private Integer userNotesCount;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("assignee")
    private Assignee assignee;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_project_id")
    private Integer targetProjectId;
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("force_remove_source_branch")
    private Boolean forceRemoveSourceBranch;
    @JsonIgnore
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("upvotes")
    public Integer getUpvotes() {
        return upvotes;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("upvotes")
    public void setUpvotes(Integer upvotes) {
        this.upvotes = upvotes;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("iid")
    public Integer getIid() {
        return iid;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("iid")
    public void setIid(Integer iid) {
        this.iid = iid;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("description")
    public String getDescription() {
        return description;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("description")
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("created_at")
    public DateTime getCreatedAt() {
        return createdAt;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("created_at")
    public void setCreatedAt(DateTime createdAt) {
        this.createdAt = createdAt;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("title")
    public String getTitle() {
        return title;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("title")
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_branch")
    public String getSourceBranch() {
        return sourceBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_branch")
    public void setSourceBranch(String sourceBranch) {
        this.sourceBranch = sourceBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("subscribed")
    public Boolean getSubscribed() {
        return subscribed;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("subscribed")
    public void setSubscribed(Boolean subscribed) {
        this.subscribed = subscribed;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("updated_at")
    public String getUpdatedAt() {
        return updatedAt;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("updated_at")
    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("project_id")
    public Integer getProjectId() {
        return projectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("project_id")
    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_commit_sha")
    public String getMergeCommitSha() {
        return mergeCommitSha;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_commit_sha")
    public void setMergeCommitSha(String mergeCommitSha) {
        this.mergeCommitSha = mergeCommitSha;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("id")
    public Integer getId() {
        return id;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("id")
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("state")
    public String getState() {
        return state;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("state")
    public void setState(String state) {
        this.state = state;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("work_in_progress")
    public Boolean getWorkInProgress() {
        return workInProgress;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("work_in_progress")
    public void setWorkInProgress(Boolean workInProgress) {
        this.workInProgress = workInProgress;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("author")
    public Author getAuthor() {
        return author;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("author")
    public void setAuthor(Author author) {
        this.author = author;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_branch")
    public String getTargetBranch() {
        return targetBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_branch")
    public void setTargetBranch(String targetBranch) {
        this.targetBranch = targetBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_project_id")
    public Integer getSourceProjectId() {
        return sourceProjectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("source_project_id")
    public void setSourceProjectId(Integer sourceProjectId) {
        this.sourceProjectId = sourceProjectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("downvotes")
    public Integer getDownvotes() {
        return downvotes;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("downvotes")
    public void setDownvotes(Integer downvotes) {
        this.downvotes = downvotes;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("should_remove_source_branch")
    public Object getShouldRemoveSourceBranch() {
        return shouldRemoveSourceBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("should_remove_source_branch")
    public void setShouldRemoveSourceBranch(Object shouldRemoveSourceBranch) {
        this.shouldRemoveSourceBranch = shouldRemoveSourceBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("sha")
    public String getSha() {
        return sha;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("sha")
    public void setSha(String sha) {
        this.sha = sha;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("labels")
    public List<Object> getLabels() {
        return labels;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("labels")
    public void setLabels(List<Object> labels) {
        this.labels = labels;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("milestone")
    public Object getMilestone() {
        return milestone;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("milestone")
    public void setMilestone(Object milestone) {
        this.milestone = milestone;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("web_url")
    public String getWebUrl() {
        return webUrl;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("web_url")
    public void setWebUrl(String webUrl) {
        this.webUrl = webUrl;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_status")
    public String getMergeStatus() {
        return mergeStatus;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_status")
    public void setMergeStatus(String mergeStatus) {
        this.mergeStatus = mergeStatus;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_when_build_succeeds")
    public Boolean getMergeWhenBuildSucceeds() {
        return mergeWhenBuildSucceeds;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("merge_when_build_succeeds")
    public void setMergeWhenBuildSucceeds(Boolean mergeWhenBuildSucceeds) {
        this.mergeWhenBuildSucceeds = mergeWhenBuildSucceeds;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("user_notes_count")
    public Integer getUserNotesCount() {
        return userNotesCount;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("user_notes_count")
    public void setUserNotesCount(Integer userNotesCount) {
        this.userNotesCount = userNotesCount;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("assignee")
    public Assignee getAssignee() {
        return assignee;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("assignee")
    public void setAssignee(Assignee assignee) {
        this.assignee = assignee;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_project_id")
    public Integer getTargetProjectId() {
        return targetProjectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("target_project_id")
    public void setTargetProjectId(Integer targetProjectId) {
        this.targetProjectId = targetProjectId;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("force_remove_source_branch")
    public Boolean getForceRemoveSourceBranch() {
        return forceRemoveSourceBranch;
    }

    /**
     *
     * (Required)
     *
     */
    @JsonProperty("force_remove_source_branch")
    public void setForceRemoveSourceBranch(Boolean forceRemoveSourceBranch) {
        this.forceRemoveSourceBranch = forceRemoveSourceBranch;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}


text:
#pragma once

#include "input_controller_comp.hpp"
#include "ai_patrolling_comp.hpp"

#include <core/renderer/camera.hpp>
#include <core/engine.hpp>
#include <core/units.hpp>
#include <core/ecs/ecs.hpp>

namespace lux {
namespace sys {
namespace physics {
	class Dynamic_body_comp;
	class Physics_system;
}
namespace controller {

	class Controller_system {
		public:
			Controller_system(Engine&, ecs::Entity_manager&, physics::Physics_system& physics_world);

			void update(Time);

			bool input_active();

			void block_input(Time t) {
				_input_block_remainder = t;
			}

			auto get_controlled() {
				return _active_controlled_entity;
			}
			void set_controlled(ecs::Entity_ptr e) {
				_active_controlled_entity = e;
			}

		private:
			util::Mailbox_collection _mailbox;
			input::Input_manager& _input_manager;
			Input_controller_comp::Pool& _input_controllers;
			Ai_patrolling_comp::Pool& _ai_controllers;
			physics::Physics_system& _physics_world;

			bool _mouse_look = true;
			float _move_dir = 0.f;
			int _move_left = 0;
			int _move_right = 0;
			bool _jump = false;
			glm::vec2 _target_dir;
			bool _transform_pending = false;
			bool _transform = false;

			ecs::Entity_ptr _active_controlled_entity;
			int _active_controlled_idx = 0;

			Time _input_block_remainder {};

			void _switch_controller(bool next);

			static void _move(Input_controller_comp& c, physics::Dynamic_body_comp& body, float dir, bool grounded, Time dt);
			static void _start_jump(Input_controller_comp& c, physics::Dynamic_body_comp& body, Time dt);
			static void _stop_jump(Input_controller_comp& c, physics::Dynamic_body_comp& body, Time dt);
	};

}
}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Mazzate
{

    public enum Colore
    {
        rosso,
        blu,
        giallo,
        verde
    }

    public class Giocatore
    {

        public Giocatore(Colore colore, Guerriero [] guerrieri)
        {
            this.colore = colore;

        }
        public Giocatore (Colore colore)
        {
            this.colore = colore;
        }

        public void creaGuerrieri(int nGuerrieri)
        {
           // Spostato in ManagerGuerrieri
        }

        public Colore Colore { get { return colore; } }

        private Colore colore;

        public Color SpriteColor
        {
            get
            {
                switch (colore)
                {
                    case Colore.blu:
                        return Color.Blue;
                    case Colore.giallo:
                        return Color.Yellow;
                    case Colore.rosso:
                        return Color.Red;
                    case Colore.verde:
                        return Color.Green;

                    default: return Color.Gray;
                }
            }
        }
       // private Guerriero[] guerrieri;
    }

}
/*
If I understand your problem properly, you should just have a direction Vector2 representing the direction you want to move in inside your sprite class. Like this:

public Vector2 Direction { get; set; }
This is the normalized vector(which means it has a length of 1) showing where you want to go.

Then, add a Speed float property, which says how fast the sprite should go.

public float Speed { get; set; }
You also need to add a UpdateSprite function, so why not put it inside your Sprite class?

public Update(GameTime gameTime)
{
   Position += Direction * Speed * gameTime.ElapsedGameTime.TotalSeconds;
}
This will update the sprite's position to make it move(you multiply by the delta seconds so that the sprite moves properly on slow computers too).

Finally, you just set your direction property like this:

sprite.Direction = location - sprite.Position;
sprite.Direction.Normalize();

*/


text:
import mock

from django.conf import settings
from django.test.client import RequestFactory
from django.test.utils import override_settings

from olympia.amo.tests import TestCase
from olympia.api.throttling import GranularUserRateThrottle

class TestGranularUserRateThrottle(TestCase):
    def setUp(self):
        self.throttle = GranularUserRateThrottle()

    def test_backwards_compatible_format(self):
        # test the original DRF rate string format x/timeperiod works
        assert self.throttle.parse_rate('1/minute') == (1, 60)
        assert self.throttle.parse_rate('24/s') == (24, 1)
        assert self.throttle.parse_rate('456/hour') == (456, 3600)

    def test_granular_format(self):
        assert self.throttle.parse_rate('1/5minute') == (1, 60 * 5)
        assert self.throttle.parse_rate('24/1s') == (24, 1)
        assert self.throttle.parse_rate('456/7hour') == (456, 7 * 3600)

    @mock.patch('rest_framework.throttling.UserRateThrottle.allow_request')
    def test_allow_request_if_api_throttling_setting_is_false(
            self, allow_request_mock):
        request = RequestFactory().get('/test')
        view = object()

        # Pretend the parent class would always throttle requests if called.
        allow_request_mock.return_value = False

        # With the setting set to True (the default), throttle as normal.
        assert settings.API_THROTTLING is True
        assert self.throttle.allow_request(request, view) is False
        assert allow_request_mock.call_count == 1

        # With the setting set to False, ignore throttling.
        with override_settings(API_THROTTLING=False):
            assert settings.API_THROTTLING is False
            assert self.throttle.allow_request(request, view) is True
            # The parent class hasn't been called an additional time.
            assert allow_request_mock.call_count == 1

        # And again set to True to be sure.
        assert settings.API_THROTTLING is True
        assert self.throttle.allow_request(request, view) is False
        assert allow_request_mock.call_count == 2


text:
module Rubinius
  module AST
    class Encoding < Node
      attr_accessor :name

      def initialize(line, name)
        @line = line
        @name = name
      end

      def bytecode(g)
        pos(g)

        g.push_literal Rubinius::Compiler::Runtime
        g.push_literal @name
        g.send :get_encoding, 1
      end

      def to_sexp
        [:encoding, @name]
      end
    end
  end
end


text:
package reporting

import "testing"

func TestPrint(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "Hello, World!"

	printer.Print(expected)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintFormat(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	template := "Hi, %s"
	name := "Ralph"
	expected := "Hi, Ralph"

	printer.Print(template, name)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintPreservesEncodedStrings(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "= -> %3D"
	printer.Print(expected)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintln(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "Hello, World!"

	printer.Println(expected)

	if file.buffer != expected+"\n" {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintlnFormat(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	template := "Hi, %s"
	name := "Ralph"
	expected := "Hi, Ralph\n"

	printer.Println(template, name)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintlnPreservesEncodedStrings(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "= -> %3D"
	printer.Println(expected)

	if file.buffer != expected+"\n" {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintIndented(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const message = "Hello, World!\nGoodbye, World!"
	const expected = "  Hello, World!\n  Goodbye, World!"

	printer.Indent()
	printer.Print(message)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintDedented(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "Hello, World!\nGoodbye, World!"

	printer.Indent()
	printer.Dedent()
	printer.Print(expected)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintlnIndented(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const message = "Hello, World!\nGoodbye, World!"
	const expected = "  Hello, World!\n  Goodbye, World!\n"

	printer.Indent()
	printer.Println(message)

	if file.buffer != expected {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestPrintlnDedented(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)
	const expected = "Hello, World!\nGoodbye, World!"

	printer.Indent()
	printer.Dedent()
	printer.Println(expected)

	if file.buffer != expected+"\n" {
		t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
	}
}

func TestDedentTooFarShouldNotPanic(t *testing.T) {
	defer func() {
		if r := recover(); r != nil {
			t.Error("Should not have panicked!")
		}
	}()
	file := newMemoryFile()
	printer := NewPrinter(file)

	printer.Dedent()

	t.Log("Getting to this point without panicking means we passed.")
}

func TestInsert(t *testing.T) {
	file := newMemoryFile()
	printer := NewPrinter(file)

	printer.Indent()
	printer.Print("Hi")
	printer.Insert(" there")
	printer.Dedent()

	expected := "  Hi there"
	if file.buffer != expected {
		t.Errorf("Should have written '%s' but instead wrote '%s'.", expected, file.buffer)
	}
}

////////////////// memoryFile ////////////////////

type memoryFile struct {
	buffer string
}

func (self *memoryFile) Write(p []byte) (n int, err error) {
	self.buffer += string(p)
	return len(p), nil
}

func (self *memoryFile) String() string {
	return self.buffer
}

func newMemoryFile() *memoryFile {
	return new(memoryFile)
}


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Interface opennlp.tools.util.model.ArtifactProvider (Apache OpenNLP Tools 1.6.0 API)</title>
<meta name="date" content="2015-06-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
opennlp.tools.util.model.ArtifactProvider

Packages that use ArtifactProvider

Package
Description

opennlp.tools.chunker

Package related to finding non-recursive syntactic annotation such as noun phrase chunks.

opennlp.tools.doccat

Package for classifying a document into a category.

opennlp.tools.namefind

Package related to finding proper names and numeric amounts.

opennlp.tools.parser

Package containing common code for performing full syntactic parsing.

opennlp.tools.postag

Package related to part-of-speech tagging.

opennlp.tools.sentdetect

Package related to identifying sentece boundries.

opennlp.tools.tokenize

Contains classes related to finding token or words in a string.

opennlp.tools.util

Package containing utility data structures and algorithms used by multiple other packages.

opennlp.tools.util.model

Uses of ArtifactProvider in opennlp.tools.chunker

Classes in opennlp.tools.chunker that implement ArtifactProvider

Modifier and Type
Class and Description

class
ChunkerModel

The ChunkerModel is the model used
 by a learnable Chunker.

Uses of ArtifactProvider in opennlp.tools.doccat

Classes in opennlp.tools.doccat that implement ArtifactProvider

Modifier and Type
Class and Description

class
DoccatModel

Uses of ArtifactProvider in opennlp.tools.namefind

Classes in opennlp.tools.namefind that implement ArtifactProvider

Modifier and Type
Class and Description

class
TokenNameFinderModel

The TokenNameFinderModel is the model used
 by a learnable TokenNameFinder.

Uses of ArtifactProvider in opennlp.tools.parser

Classes in opennlp.tools.parser that implement ArtifactProvider

Modifier and Type
Class and Description

class
ParserModel

This is an abstract base class for ParserModel implementations.

Uses of ArtifactProvider in opennlp.tools.postag

Classes in opennlp.tools.postag that implement ArtifactProvider

Modifier and Type
Class and Description

class
POSModel

The POSModel is the model used
 by a learnable POSTagger.

Uses of ArtifactProvider in opennlp.tools.sentdetect

Classes in opennlp.tools.sentdetect that implement ArtifactProvider

Modifier and Type
Class and Description

class
SentenceModel

The SentenceModel is the model used
 by a learnable SentenceDetector.

Uses of ArtifactProvider in opennlp.tools.tokenize

Classes in opennlp.tools.tokenize that implement ArtifactProvider

Modifier and Type
Class and Description

class
TokenizerModel

The TokenizerModel is the model used
 by a learnable Tokenizer.

Uses of ArtifactProvider in opennlp.tools.util

Fields in opennlp.tools.util declared as ArtifactProvider

Modifier and Type
Field and Description

protected ArtifactProvider
BaseToolFactory.artifactProvider

Methods in opennlp.tools.util with parameters of type ArtifactProvider

Modifier and Type
Method and Description

static BaseToolFactory
BaseToolFactory.create(Class<? extends BaseToolFactory> factoryClass,
      ArtifactProvider artifactProvider)

static BaseToolFactory
BaseToolFactory.create(String subclassName,
      ArtifactProvider artifactProvider)

protected void
BaseToolFactory.init(ArtifactProvider artifactProvider)

Initializes the ToolFactory with an artifact provider.

Uses of ArtifactProvider in opennlp.tools.util.model

Classes in opennlp.tools.util.model that implement ArtifactProvider

Modifier and Type
Class and Description

class
BaseModel

This model is a common based which can be used by the components
 model classes.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2015 The Apache Software Foundation. All rights reserved.


text:
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

    <style name="StyleListView">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:divider">#787878</item>
        <item name="android:cacheColorHint">#000000</item>
    </style>

</resources>


text:
package gcm

// Message is used by the application server to send a message to
// the GCM server. See the documentation for GCM Architectural
// Overview for more information:
// http://developer.android.com/google/gcm/gcm.html#send-msg
type Message struct {
	RegistrationIDs       []string               `json:"registration_ids"`
	CollapseKey           string                 `json:"collapse_key,omitempty"`
	Data                  map[string]interface{} `json:"data,omitempty"`
	DelayWhileIdle        bool                   `json:"delay_while_idle,omitempty"`
	TimeToLive            int                    `json:"time_to_live,omitempty"`
	RestrictedPackageName string                 `json:"restricted_package_name,omitempty"`
	DryRun                bool                   `json:"dry_run,omitempty"`
}

// NewMessage returns a new Message with the specified payload
// and registration IDs.
func NewMessage(data map[string]interface{}, regIDs ...string) *Message {
	return &Message{RegistrationIDs: regIDs, Data: data}
}


text:
'use strict';

var AWSClass = require('../AWSClass.js');

var propertyMap = {'Attributes': {'list': false, 'type': 'object'},
 'InstancePorts': {'list': true, 'type': 'string'},
 'LoadBalancerPorts': {'list': true, 'type': 'string'},
 'PolicyName': {'list': false, 'type': 'string'},
 'PolicyType': {'list': false, 'type': 'string'}};

var Class = function (id) {
    return AWSClass.call(this, id, 'Ec2ElbPolicy', {});
};
require('util').inherits(Class, AWSClass);

Class = AWSClass.registerPropertyPrototypes(Class, propertyMap);
module.exports = Class;


text:
// Copyright 2013 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 "ash/display/resolution_notification_controller.h"

#include "ash/display/display_controller.h"
#include "ash/display/display_info.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
#include "ash/system/system_notifier.h"
#include "base/strings/utf_string_conversions.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/notification.h"
#include "ui/message_center/notification_delegate.h"

using message_center::Notification;

namespace ash {
namespace {

bool g_use_timer = true;

class ResolutionChangeNotificationDelegate
    : public message_center::NotificationDelegate {
 public:
  ResolutionChangeNotificationDelegate(
      ResolutionNotificationController* controller,
      bool has_timeout);

 protected:
  ~ResolutionChangeNotificationDelegate() override;

 private:
  // message_center::NotificationDelegate overrides:
  void Close(bool by_user) override;
  void Click() override;
  bool HasClickedListener() override;
  void ButtonClick(int button_index) override;

  ResolutionNotificationController* controller_;
  bool has_timeout_;

  DISALLOW_COPY_AND_ASSIGN(ResolutionChangeNotificationDelegate);
};

ResolutionChangeNotificationDelegate::ResolutionChangeNotificationDelegate(
    ResolutionNotificationController* controller,
    bool has_timeout)
    : controller_(controller),
      has_timeout_(has_timeout) {
  DCHECK(controller_);
}

ResolutionChangeNotificationDelegate::~ResolutionChangeNotificationDelegate() {
}

void ResolutionChangeNotificationDelegate::Close(bool by_user) {
  if (by_user)
    controller_->AcceptResolutionChange(false);
}

void ResolutionChangeNotificationDelegate::Click() {
  controller_->AcceptResolutionChange(true);
}

bool ResolutionChangeNotificationDelegate::HasClickedListener() {
  return true;
}

void ResolutionChangeNotificationDelegate::ButtonClick(int button_index) {
  // If there's the timeout, the first button is "Accept". Otherwise the
  // button click should be "Revert".
  if (has_timeout_ && button_index == 0)
    controller_->AcceptResolutionChange(true);
  else
    controller_->RevertResolutionChange();
}

}  // namespace

// static
const int ResolutionNotificationController::kTimeoutInSec = 15;

// static
const char ResolutionNotificationController::kNotificationId[] =
    "chrome://settings/display/resolution";

struct ResolutionNotificationController::ResolutionChangeInfo {
  ResolutionChangeInfo(int64 display_id,
                       const DisplayMode& old_resolution,
                       const DisplayMode& new_resolution,
                       const base::Closure& accept_callback);
  ~ResolutionChangeInfo();

  // The id of the display where the resolution change happens.
  int64 display_id;

  // The resolution before the change.
  DisplayMode old_resolution;

  // The requested resolution. Note that this may be different from
  // |current_resolution| which is the actual resolution set.
  DisplayMode new_resolution;

  // The actual resolution after the change.
  DisplayMode current_resolution;

  // The callback when accept is chosen.
  base::Closure accept_callback;

  // The remaining timeout in seconds. 0 if the change does not time out.
  uint8 timeout_count;

  // The timer to invoke OnTimerTick() every second. This cannot be
  // OneShotTimer since the message contains text "automatically closed in xx
  // seconds..." which has to be updated every second.
  base::RepeatingTimer<ResolutionNotificationController> timer;

 private:
  DISALLOW_COPY_AND_ASSIGN(ResolutionChangeInfo);
};

ResolutionNotificationController::ResolutionChangeInfo::ResolutionChangeInfo(
    int64 display_id,
    const DisplayMode& old_resolution,
    const DisplayMode& new_resolution,
    const base::Closure& accept_callback)
    : display_id(display_id),
      old_resolution(old_resolution),
      new_resolution(new_resolution),
      accept_callback(accept_callback),
      timeout_count(0) {
  DisplayManager* display_manager = Shell::GetInstance()->display_manager();
  if (!gfx::Display::HasInternalDisplay() &&
      display_manager->num_connected_displays() == 1u) {
    timeout_count = kTimeoutInSec;
  }
}

ResolutionNotificationController::ResolutionChangeInfo::
    ~ResolutionChangeInfo() {
}

ResolutionNotificationController::ResolutionNotificationController() {
  Shell::GetInstance()->display_controller()->AddObserver(this);
  Shell::GetScreen()->AddObserver(this);
}

ResolutionNotificationController::~ResolutionNotificationController() {
  Shell::GetInstance()->display_controller()->RemoveObserver(this);
  Shell::GetScreen()->RemoveObserver(this);
}

void ResolutionNotificationController::PrepareNotification(
    int64 display_id,
    const DisplayMode& old_resolution,
    const DisplayMode& new_resolution,
    const base::Closure& accept_callback) {
  // If multiple resolution changes are invoked for the same display,
  // the original resolution for the first resolution change has to be used
  // instead of the specified |old_resolution|.
  DisplayMode original_resolution;
  if (change_info_ && change_info_->display_id == display_id) {
    DCHECK(change_info_->new_resolution.size == old_resolution.size);
    original_resolution = change_info_->old_resolution;
  }

  change_info_.reset(new ResolutionChangeInfo(
      display_id, old_resolution, new_resolution, accept_callback));
  if (!original_resolution.size.IsEmpty())
    change_info_->old_resolution = original_resolution;
}

bool ResolutionNotificationController::DoesNotificationTimeout() {
  return change_info_ && change_info_->timeout_count > 0;
}

void ResolutionNotificationController::CreateOrUpdateNotification(
    bool enable_spoken_feedback) {
  message_center::MessageCenter* message_center =
      message_center::MessageCenter::Get();
  if (!change_info_) {
    message_center->RemoveNotification(kNotificationId, false /* by_user */);
    return;
  }

  base::string16 timeout_message;
  message_center::RichNotificationData data;
  if (change_info_->timeout_count > 0) {
    data.buttons.push_back(message_center::ButtonInfo(
        l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_RESOLUTION_CHANGE_ACCEPT)));
    timeout_message = l10n_util::GetStringFUTF16(
        IDS_ASH_DISPLAY_RESOLUTION_TIMEOUT,
        ui::TimeFormat::Simple(
            ui::TimeFormat::FORMAT_DURATION, ui::TimeFormat::LENGTH_LONG,
            base::TimeDelta::FromSeconds(change_info_->timeout_count)));
  }
  data.buttons.push_back(message_center::ButtonInfo(
        l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_RESOLUTION_CHANGE_REVERT)));

  data.should_make_spoken_feedback_for_popup_updates = enable_spoken_feedback;

  const base::string16 display_name = base::UTF8ToUTF16(
      Shell::GetInstance()->display_manager()->GetDisplayNameForId(
          change_info_->display_id));
  const base::string16 message =
      (change_info_->new_resolution.size ==
       change_info_->current_resolution.size) ?
      l10n_util::GetStringFUTF16(
          IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
          display_name,
          base::UTF8ToUTF16(change_info_->new_resolution.size.ToString())) :
      l10n_util::GetStringFUTF16(
          IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED_TO_UNSUPPORTED,
          display_name,
          base::UTF8ToUTF16(change_info_->new_resolution.size.ToString()),
          base::UTF8ToUTF16(change_info_->current_resolution.size.ToString()));

  ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
  scoped_ptr<Notification> notification(new Notification(
      message_center::NOTIFICATION_TYPE_SIMPLE,
      kNotificationId,
      message,
      timeout_message,
      bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
      base::string16() /* display_source */,
      message_center::NotifierId(
          message_center::NotifierId::SYSTEM_COMPONENT,
          system_notifier::kNotifierDisplayResolutionChange),
      data,
      new ResolutionChangeNotificationDelegate(
          this, change_info_->timeout_count > 0)));
  notification->SetSystemPriority();
  message_center->AddNotification(notification.Pass());
}

void ResolutionNotificationController::OnTimerTick() {
  if (!change_info_)
    return;

  --change_info_->timeout_count;
  if (change_info_->timeout_count == 0)
    RevertResolutionChange();
  else
    CreateOrUpdateNotification(false);
}

void ResolutionNotificationController::AcceptResolutionChange(
    bool close_notification) {
  if (close_notification) {
    message_center::MessageCenter::Get()->RemoveNotification(
        kNotificationId, false /* by_user */);
  }
  if (!change_info_)
    return;
  base::Closure callback = change_info_->accept_callback;
  change_info_.reset();
  callback.Run();
}

void ResolutionNotificationController::RevertResolutionChange() {
  message_center::MessageCenter::Get()->RemoveNotification(
      kNotificationId, false /* by_user */);
  if (!change_info_)
    return;
  int64 display_id = change_info_->display_id;
  DisplayMode old_resolution = change_info_->old_resolution;
  change_info_.reset();
  Shell::GetInstance()->display_manager()->SetDisplayMode(
      display_id, old_resolution);
}

void ResolutionNotificationController::OnDisplayAdded(
    const gfx::Display& new_display) {
}

void ResolutionNotificationController::OnDisplayRemoved(
    const gfx::Display& old_display) {
  if (change_info_ && change_info_->display_id == old_display.id())
    RevertResolutionChange();
}

void ResolutionNotificationController::OnDisplayMetricsChanged(
    const gfx::Display&, uint32_t) {
}

void ResolutionNotificationController::OnDisplayConfigurationChanged() {
  if (!change_info_)
    return;

  change_info_->current_resolution = Shell::GetInstance()->display_manager()->
      GetActiveModeForDisplayId(change_info_->display_id);
  CreateOrUpdateNotification(true);
  if (g_use_timer && change_info_->timeout_count > 0) {
    change_info_->timer.Start(FROM_HERE,
                              base::TimeDelta::FromSeconds(1),
                              this,
                              &ResolutionNotificationController::OnTimerTick);
  }
}

void ResolutionNotificationController::SuppressTimerForTest() {
  g_use_timer = false;
}

}  // namespace ash


text:
package org.apache.calcite.sql;

/**
 * SqlProcedureCallOperator represents the CALL statement. It takes a single
 * operand which is the real SqlCall.
 */
public class SqlProcedureCallOperator extends SqlPrefixOperator {
  //~ Constructors -----------------------------------------------------------

  public SqlProcedureCallOperator() {
    super("CALL", SqlKind.PROCEDURE_CALL, 0, null, null, null);
  }

  //~ Methods ----------------------------------------------------------------

}


text:
.class final Landroid/database/sqlite/SQLiteConnection$Operation;
.super Ljava/lang/Object;
.source "SQLiteConnection.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/database/sqlite/SQLiteConnection;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1a
    name = "Operation"
.end annotation

# static fields
.field private static final sDateFormat:Ljava/text/SimpleDateFormat;

# instance fields
.field public mBindArgs:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation
.end field

.field public mCookie:I

.field public mEndTime:J

.field public mException:Ljava/lang/Exception;

.field public mFinished:Z

.field public mKind:Ljava/lang/String;

.field public mSql:Ljava/lang/String;

.field public mStartTime:J

# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    .line 1476
    new-instance v0, Ljava/text/SimpleDateFormat;

    const-string/jumbo v1, "yyyy-MM-dd HH:mm:ss.SSS"

    invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    sput-object v0, Landroid/database/sqlite/SQLiteConnection$Operation;->sDateFormat:Ljava/text/SimpleDateFormat;

    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 1475
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Landroid/database/sqlite/SQLiteConnection$1;)V
    .locals 0
    .param p1, "x0"    # Landroid/database/sqlite/SQLiteConnection$1;

    .prologue
    .line 1475
    invoke-direct {p0}, Landroid/database/sqlite/SQLiteConnection$Operation;-><init>()V

    return-void
.end method

.method static synthetic access$600(Landroid/database/sqlite/SQLiteConnection$Operation;)Ljava/lang/String;
    .locals 1
    .param p0, "x0"    # Landroid/database/sqlite/SQLiteConnection$Operation;

    .prologue
    .line 1475
    invoke-direct {p0}, Landroid/database/sqlite/SQLiteConnection$Operation;->getFormattedStartTime()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private getFormattedStartTime()Ljava/lang/String;
    .locals 4

    .prologue
    .line 1533
    sget-object v0, Landroid/database/sqlite/SQLiteConnection$Operation;->sDateFormat:Ljava/text/SimpleDateFormat;

    new-instance v1, Ljava/util/Date;

    iget-wide v2, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mStartTime:J

    invoke-direct {v1, v2, v3}, Ljava/util/Date;-><init>(J)V

    invoke-virtual {v0, v1}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private getStatus()Ljava/lang/String;
    .locals 1

    .prologue
    .line 1526
    iget-boolean v0, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mFinished:Z

    if-nez v0, :cond_0

    .line 1527
    const-string/jumbo v0, "running"

    .line 1529
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mException:Ljava/lang/Exception;

    if-eqz v0, :cond_1

    const-string v0, "failed"

    goto :goto_0

    :cond_1
    const-string/jumbo v0, "succeeded"

    goto :goto_0
.end method

# virtual methods
.method public describe(Ljava/lang/StringBuilder;Z)V
    .locals 8
    .param p1, "msg"    # Ljava/lang/StringBuilder;
    .param p2, "verbose"    # Z

    .prologue
    .line 1489
    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mKind:Ljava/lang/String;

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1490
    iget-boolean v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mFinished:Z

    if-eqz v3, :cond_2

    .line 1491
    const-string v3, " took "

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-wide v4, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mEndTime:J

    iget-wide v6, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mStartTime:J

    sub-long/2addr v4, v6

    invoke-virtual {v3, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string/jumbo v4, "ms"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1496
    :goto_0
    const-string v3, " - "

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-direct {p0}, Landroid/database/sqlite/SQLiteConnection$Operation;->getStatus()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1497
    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mSql:Ljava/lang/String;

    if-eqz v3, :cond_0

    .line 1498
    const-string v3, ", sql=\""

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mSql:Ljava/lang/String;

    # invokes: Landroid/database/sqlite/SQLiteConnection;->trimSqlForDisplay(Ljava/lang/String;)Ljava/lang/String;
    invoke-static {v4}, Landroid/database/sqlite/SQLiteConnection;->access$300(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\""

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1500
    :cond_0
    if-eqz p2, :cond_7

    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mBindArgs:Ljava/util/ArrayList;

    if-eqz v3, :cond_7

    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mBindArgs:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v3

    if-eqz v3, :cond_7

    .line 1501
    const-string v3, ", bindArgs=["

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1502
    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mBindArgs:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v1

    .line 1503
    .local v1, "count":I
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_1
    if-ge v2, v1, :cond_6

    .line 1504
    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mBindArgs:Ljava/util/ArrayList;

    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    .line 1505
    .local v0, "arg":Ljava/lang/Object;
    if-eqz v2, :cond_1

    .line 1506
    const-string v3, ", "

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1508
    :cond_1
    if-nez v0, :cond_3

    .line 1509
    const-string/jumbo v3, "null"

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1503
    .end local v0    # "arg":Ljava/lang/Object;
    :goto_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 1493
    .end local v1    # "count":I
    .end local v2    # "i":I
    :cond_2
    const-string v3, " started "

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v4

    iget-wide v6, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mStartTime:J

    sub-long/2addr v4, v6

    invoke-virtual {v3, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string/jumbo v4, "ms ago"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_0

    .line 1510
    .restart local v0    # "arg":Ljava/lang/Object;
    .restart local v1    # "count":I
    .restart local v2    # "i":I
    :cond_3
    instance-of v3, v0, [B

    if-eqz v3, :cond_4

    .line 1511
    const-string v3, "<byte[]>"

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_2

    .line 1512
    :cond_4
    instance-of v3, v0, Ljava/lang/String;

    if-eqz v3, :cond_5

    .line 1513
    const-string v3, "\""

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    check-cast v0, Ljava/lang/String;

    .end local v0    # "arg":Ljava/lang/Object;
    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\""

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_2

    .line 1515
    .restart local v0    # "arg":Ljava/lang/Object;
    :cond_5
    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    goto :goto_2

    .line 1518
    .end local v0    # "arg":Ljava/lang/Object;
    :cond_6
    const-string v3, "]"

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1520
    .end local v1    # "count":I
    .end local v2    # "i":I
    :cond_7
    iget-object v3, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mException:Ljava/lang/Exception;

    if-eqz v3, :cond_8

    .line 1521
    const-string v3, ", exception=\""

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, p0, Landroid/database/sqlite/SQLiteConnection$Operation;->mException:Ljava/lang/Exception;

    invoke-virtual {v4}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\""

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 1523
    :cond_8
    return-void
.end method


text:
module RCL (module RCLExport) where

-- imports

import           RCL.Auth     as RCLExport
import           RCL.Config   as RCLExport
import           RCL.Error    as RCLExport
import           RCL.Filter   as RCLExport
import           RCL.Methods  as RCLExport
import           RCL.Query    as RCLExport
import           RCL.Response as RCLExport
import           RCL.RTM      as RCLExport
import           RCL.Services as RCLExport
import           RCL.Session  as RCLExport
import           RCL.Task     as RCLExport
import           RCL.Types    as RCLExport


text:
from django.contrib import admin

from .models import Request

# Register your models here.

admin.site.register(Request)


text:
#pragma once

/**
 * \file sal/crypto/channel.hpp
 * Secure encrypted channel using TLS/DTLS.
 */

#include <sal/config.hpp>
#include <sal/crypto/__bits/channel.hpp>
#include <sal/crypto/channel_options.hpp>
#include <sal/crypto/error.hpp>
#include <sal/memory.hpp>

__sal_begin

namespace crypto {

/**
 * Secure encrypted two-way communication channel using TLS or DTLS.
 * This class is transport independent protocol parser/generator: feed packets
 * with handshake/encrypt/decrypt and it invokes callback with ready messages.
 *
 * To set up new channel, both parties must call handshake() repeatedly and
 * send generated messages back and forth until session and it's settings are
 * agreed (is_connected() will return true on both sides). To initiate
 * negotiations, handshake() must be called first on client side (with no
 * input data).
 *
 * Once session is established, new invocations of handshake() will generate
 * error (currently re-negotiation is not supported). In this state,
 * application can call encrypt() to generate secret text from plain text and
 * decrypt() for reverse operation.
 *
 * \see https://en.wikipedia.org/wiki/Transport_Layer_Security
 */
class channel_t
{
public:

  /**
   * Callbacks for handshake/encrypted/decrypted buffers. Channel allocates
   * new buffers with alloc() and returns those buffers to transport layer
   * with ready().
   */
  struct buffer_manager_t
  {
    virtual ~buffer_manager_t () noexcept = default;

    /**
     * Callback to allocate new buffer. On return, set \a buffer to pointer of
     * new memory area with \a buffer_size where output message will be
     * stored. If generated message does not fit into \a buffer, this callback
     * is called multiple times for new chunks until whole message is stored.
     * For each buffer, ready() will be called separately.
     *
     * Return value uintptr_t can be used by application layer to tie each
     * returned buffer with application-specific data. It is not used by
     * channel except storing and returning back to application in call to
     * ready().
     */
    virtual uintptr_t alloc (uint8_t **buffer, size_t *buffer_size) noexcept = 0;

    /**
     * Callback for stored message (or chunks if message is split between
     * multiple buffers). \a Buffer contains pointer returned by alloc() and
     * \a buffer_size has number of actually stored bytes. It's value might be
     * zero if channel did not generate any output, in which case \a buffer
     * can be simply released.
     *
     * For meaning of \a user_data, see alloc()
     */
    virtual void ready (uintptr_t user_data, uint8_t *buffer, size_t buffer_size) noexcept = 0;
  };

  /**
   * Return true if all the handshakes are successfully finished and channel
   * is ready of encrypt/decrypt operations.
   */
  bool is_connected () const noexcept
  {
    return impl_->handshake_status == std::errc::already_connected;
  }

  /**
   * Proceed with session negotiations. \a data must contain message(s) sent
   * by remote party. \a buffer_manager is used to allocate buffers for output
   * messages (or it's chunks). Once is_connected() returns true, current side
   * has finished with handshakes.
   *
   * \a data may contain more than current handshake stage needed. In this
   * case, method returns number of bytes actually used. It is application
   * responsibility to remove those bytes from \a data and feed remaining
   * content again to handshake() (possibly with additional bytes from remote
   * party).
   *
   * There is also special case on client side: \a data may contain both
   * handshake and application data. In this case, application should remove
   * used \a data and if is_connected() is true, call decrypt() with remaining
   * \a data.
   *
   * In case of negotiations failure, set \a error to describe error
   * situation. During handshake phase, all errors are final i.e. negotiation
   * will be stopped.
   */
  template <typename Data>
  size_t handshake (const Data &data,
    buffer_manager_t &buffer_manager,
    std::error_code &error) noexcept
  {
    if (impl_->handshake_status == std::errc::not_connected)
    {
      using std::cbegin;
      using std::cend;
      return handshake(
        to_ptr(cbegin(data)),
        range_size(cbegin(data), cend(data)),
        buffer_manager,
        error
      );
    }
    error = impl_->handshake_status;
    return {};
  }

  /**
   * \see handshake()
   * Instead of setting \a error, throw std::system_error
   */
  template <typename Data>
  size_t handshake (const Data &data, buffer_manager_t &buffer_manager)
  {
    return handshake(data, buffer_manager,
      throw_on_error("channel::handshake")
    );
  }

  /**
   * Encrypt \a data, setting \a error on failure. Generated secret text is
   * stored in buffer(s) allocated by \a buffer_manager.
   *
   * This method can succeed only when is_connected() returns true.
   */
  template <typename Data>
  void encrypt (const Data &data,
    buffer_manager_t &buffer_manager,
    std::error_code &error) noexcept
  {
    if (impl_->handshake_status == std::errc::already_connected)
    {
      using std::cbegin;
      using std::cend;
      encrypt(
        to_ptr(cbegin(data)),
        range_size(cbegin(data), cend(data)),
        buffer_manager,
        error
      );
    }
    else
    {
      error = impl_->handshake_status;
    }
  }

  /**
   * \see encrypt()
   * Instead of setting \a error, throw std::system_error
   */
  template <typename Data>
  void encrypt (const Data &data, buffer_manager_t &buffer_manager)
  {
    encrypt(data, buffer_manager, throw_on_error("channel::encrypt"));
  }

  /**
   * Decrypt secret text in \a data returning plain text in buffer(s)
   * allocated by \a buffer_manager. On failure, set \a error. Returns number
   * of bytes actually used from \a data. It is application's responsibility
   * to remove used \a data and invoke this method again with remaining of
   * \a data (with possible additional data from remote peer).
   *
   * This method can succeed only when is_connected() returns true.
   */
  template <typename Data>
  size_t decrypt (const Data &data,
    buffer_manager_t &buffer_manager,
    std::error_code &error) noexcept
  {
    if (impl_->handshake_status == std::errc::already_connected)
    {
      using std::cbegin;
      using std::cend;
      return decrypt(
        to_ptr(cbegin(data)),
        range_size(cbegin(data), cend(data)),
        buffer_manager,
        error
      );
    }
    error = impl_->handshake_status;
    return {};
  }

  /**
   * \see decrypt()
   * Instead of setting \a error, throw std::system_error
   */
  template <typename Data>
  size_t decrypt (const Data &data, buffer_manager_t &buffer_manager)
  {
    return decrypt(data, buffer_manager, throw_on_error("channel::decrypt"));
  }

private:

  __bits::channel_ptr impl_;

  channel_t (__bits::channel_ptr &&impl) noexcept
    : impl_(std::move(impl))
  { }

  size_t handshake (const uint8_t *data, size_t size,
    buffer_manager_t &buffer_manager,
    std::error_code &error
  ) noexcept;

  void encrypt (const uint8_t *data, size_t size,
    buffer_manager_t &buffer_manager,
    std::error_code &error
  ) noexcept;

  size_t decrypt (const uint8_t *data, size_t size,
    buffer_manager_t &buffer_manager,
    std::error_code &error
  ) noexcept;

  template <bool Datagram, bool Server>
  friend class channel_factory_t;
};

/**
 * Factory class for creating new secure channel_t.
 *
 * It constructs one time internal setup (certificate chain, etc) that will be
 * reused to create multiple similar channel_t instances (a la acceptor on
 * server side and so on).
 *
 * \a Datagram specifies whether to use datagrams (DTLS) or streaming (TLS)
 * approach to handle exchanged messages.
 *
 * \a Server specifies whether it's server side (i.e. acceptor) or client side
 * (i.e. connector).
 */
template <bool Datagram, bool Server>
class channel_factory_t
{
public:

  /**
   * Construct new channel factory with number of \a options (none, one or
   * more).
   *
   * \see channel_factory_option_t
   */
  template <typename... Option>
  channel_factory_t (const channel_factory_option_t<Option> &...options)
    : impl_(std::make_shared<__bits::channel_factory_t>(Datagram, Server))
  {
    (set_option(static_cast<const Option &>(options)), ...);
    impl_->ctor(throw_on_error("channel_factory"));
  }

  /**
   * Construct new channel with number of channel \a options (none, one or
   * more).
   *
   * \see channel_option_t
   */
  template <typename... Option>
  channel_t make_channel (const channel_option_t<Option> &...options)
  {
    auto channel = std::make_unique<__bits::channel_t>(impl_);
    (set_option(*channel, static_cast<const Option &>(options)), ...);
    channel->ctor(throw_on_error("channel_factory::make_channel"));
    return channel;
  }

private:

  __bits::channel_factory_ptr impl_{};

  void set_option (const with_chain_t &option) noexcept
  {
    impl_->chain = option.value;
  }

  void set_option (const with_private_key_t &option) noexcept
  {
#if __sal_os_linux
    // used only on Linux, other platforms keep private key in secured memory
    impl_->private_key = option.private_key->native_handle().ref;
#else
    (void)option;
#endif
  }

  template <typename Check>
  void set_option (const chain_check_t<Check> &option) noexcept
  {
    impl_->chain_check = option.value;
  }

  void set_option (__bits::channel_t &channel, const mutual_auth_t &option)
    noexcept
  {
    channel.mutual_auth = option.value;
  }

  void set_option (__bits::channel_t &channel, const peer_name_t &option)
  {
    channel.peer_name = option.value;
  }
};

/**
 * TLS client side channel factory.
 */
using stream_client_channel_factory_t = channel_factory_t<false, false>;

/**
 * TLS server side channel factory.
 */
using stream_server_channel_factory_t = channel_factory_t<false, true>;

/**
 * DTLS client side channel factory.
 */
using datagram_client_channel_factory_t = channel_factory_t<true, false>;

/**
 * DTLS server side channel factory.
 */
using datagram_server_channel_factory_t = channel_factory_t<true, true>;

/**
 * Construct and return new TLS client side channel factory using \a options.
 */
template <typename... Option>
inline stream_client_channel_factory_t stream_client_channel_factory (
  const channel_factory_option_t<Option> &...options)
{
  return {options...};
}

/**
 * Construct and return new TLS server side channel factory using \a options.
 */
template <typename... Option>
inline stream_server_channel_factory_t stream_server_channel_factory (
  const channel_factory_option_t<Option> &...options)
{
  return {options...};
}

/**
 * Construct and return new DTLS client side channel factory using \a options.
 */
template <typename... Option>
inline datagram_client_channel_factory_t datagram_client_channel_factory (
  const channel_factory_option_t<Option> &...options)
{
  return {options...};
}

/**
 * Construct and return new DTLS server side channel factory using \a options.
 */
template <typename... Option>
inline datagram_server_channel_factory_t datagram_server_channel_factory (
  const channel_factory_option_t<Option> &...options)
{
  return {options...};
}

} // namespace crypto

__sal_end


text:
package ai.agnos.sparql.api

import akka.actor.ActorSystem
import akka.http.scaladsl.model.{StatusCode, StatusCodes}
import akka.http.scaladsl.model.HttpMethods._

trait SparqlClientProtocol extends ClientAPIProtocol

/**
  * Represents a single Sparql request to be sent to the triple store.
  *
  * @param statement the sparql statement string, any | margins will be stripped automatically
  * @param context an optional context to be carried along the flow
  */
case class SparqlRequest(statement: SparqlStatement, context: Option[Any] = None) extends ClientHttpRequest with SparqlClientProtocol {
  override def httpMethod = GET
}

/**
  * "Is-Alive" request
  */
// JC: not used
case object PingRequest extends Request

/**
  * Represents a response from the triple store for a Sparql request.
  *
  * @param request the underlying request object is returned with the response
  * @param success true if the sparql statement execution succeeded
  * @param status the HTTP status of the result
  * @param result results
  * @param error optional error message, if available
  */
case class SparqlResponse(
  request: SparqlRequest,
  success: Boolean = true,
  status: StatusCode = StatusCodes.OK,
  result: List[SparqlResult] = Nil,
  error: Option[SparqlClientError] = None) extends ClientHttpResponse with SparqlClientProtocol

/**
  * "Is-Alive" response
  *
  * @param success
  */
// JC: not used
case class PingResponse(success: Boolean = true) extends ClientHttpResponse with SparqlClientProtocol

/**
  * Error messages
  */
sealed trait SparqlClientError
case class SparqlClientRequestFailed(message: String) extends RuntimeException(message) with SparqlClientError
case class SparqlClientRequestFailedWithError(message: String, throwable: Throwable) extends RuntimeException(message, throwable) with SparqlClientError

trait ErrorHandlerSupport {
  def errorHandler: ErrorHandler
}

abstract class ErrorHandler {
  def handleError(error: Throwable)(implicit system: ActorSystem): Unit
}

object DefaultErrorHandler extends ErrorHandler {
  override def handleError(error: Throwable)(implicit system: ActorSystem): Unit = {
    system.log.error(s"STREAM FAILED with: $error")
    throw new RuntimeException("unexpected error encountered, collapsing stream", error)
  }
}

object IgnoreAndLogErrorHandler extends ErrorHandler {
  override def handleError(error: Throwable)(implicit system: ActorSystem): Unit = {
    system.log.error(s"IGNORED: SPARQL client encountered an error shown below an will continue")
    error.printStackTrace(System.err)
  }
}

case class SystemExitErrorHandler(exitCode: Int) extends ErrorHandler {
  override def handleError(error: Throwable)(implicit system: ActorSystem): Unit = {
    system.log.error(s"CRITICAL: Error attached below, the JVM will exit with code $exitCode")
    error.printStackTrace(System.err)
    System.exit(exitCode)
  }
}


text:
* Initial implementation

Last Release: v1.0.0 (2014-05-15)
-------------------
- First public release


text:
"""Methods to run the locate script more exactly"""

import re
import os
import sys
import argparse
try:
    from commands import getoutput, getstatusoutput
except ImportError:
    from subprocess import getoutput, getstatusoutput
from fnmatch import fnmatch

from repositories import repository
from pysyte.types.paths import path as makepath
from pysyte import splits

def _path_to_locate():
    """Location of the locate command on most unixen"""
    homebrewed_findutils = makepath('/usr/local/Cellar/findutils/4.4.2/bin/')
    for basename in ('locate', 'glocate'):
        homebrewed_locate = homebrewed_findutils / basename
        if homebrewed_locate.isfile():
            return homebrewed_locate
    return '/usr/bin/locate'

def _add_option(path_to_locate, option):
    if option[:2] != '--':
        option = '--%s' % option
    if option in getoutput('%s -h' % path_to_locate):
        return '%s %s' % (path_to_locate, option)
    return path_to_locate

def _locate_regexp_option():
    command = '%s --help' % _path_to_locate()
    _status, output = getstatusoutput(command)
    return '--regexp' if '--regexp' in output else '--regex'

def glob_to_regexp(string):
    parts = splits.split_and_strip_whole(string, '[*?[]')
    if len(parts) == 1:
        if re.match('[*?[]', string[0]):
            parts.insert(0, '')
        elif re.match('[*?[]', string[-1]):
            parts.append('')
    return '.*'.join(parts)

def _make_locate_command(args):
    """Make a command to locate sought arg"""
    option = args.ignore_case and '-i' or ''
    if args.globs:
        option = _locate_regexp_option()
        string = glob_to_regexp(args.sought)
    else:
        string = args.sought
    path_to_locate = _path_to_locate()
    if args.files or args.directories or args.executables:
        _add_option(path_to_locate, '--basename')
    return '%s %s "%s"' % (path_to_locate, option, string)

def _locatable(path):
    """Whether that path is wanted in location results"""
    return not repository.is_repository_path(path)

def _run_locate(args):
    """Run the locate command on the sought arg"""
    command = _make_locate_command(args)
    if args.verbose:
        print(command)
    status, output = getstatusoutput(command)
    if status and output:
        old = re.search('is more than .* days old', output)
        if not old:
            raise ValueError('command: %s\n output: %s' % (command, output))
    elif not output:
        return []
    locatable = [l for l in output.split('\n') if _locatable(l)]
    for exclude in args.exclude or []:
        locatable = [_ for _ in locatable if not re.search(exclude, _)]
    return locatable

def _make_check_method(method, args):
    """Make a check method by combining the given method with the args"""

    def make_method(predicate):
        def inner_method(string):
            return method(string) and predicate(string)
        return inner_method

    if args.directories:
        return make_method(os.path.isdir)
    if args.files:
        return make_method(os.path.isfile)
    if args.executables:
        return make_method(lambda x: os.path.isfile(x) and os.access(x, os.X_OK))
    if args.real:
        return make_method(os.path.exists)
    return method

def _locate(args):
    """Locate some files called sought arg, restricted by the given args"""

    def _compare(one, two):
        if args.ignore_case:
            one = one.upper()
            two = two.upper()
        if args.globs:
            if '*' not in two:
                two = f'*{two}*'
            return fnmatch(one, two)
        # cmp? pylint: disable=undefined-variable
        try:
            return cmp(one, two) == 0
        except NameError:
            if args.basename:
                return one == two
            return (one > two) - (one < two)

    def _directory_in_path(path):
        test_string = args.sought
        parts = path.split(os.path.sep)
        if args.basename:
            parts = parts[-1:]
        for part in parts:
            if _compare(part, test_string):
                return True
        return False

    lines = _run_locate(args)
    check = _make_check_method(_directory_in_path, args)
    result = [l for l in lines if check(l)]
    if result:
        return result
    if args.directories or args.files:
        return []
    return lines

def parse_args():
    """Handle arguments from the command line"""
    parser = argparse.ArgumentParser()
    pa = parser.add_argument
    pa('sought', help='String to locate')
    pa('-b', '--basename', action='store_true', help='only find basenames')
    pa('-d', '--directories', action='store_true', help='only locate directories')
    pa('-e', '--executables', action='store_true', help='only locate executable files')
    pa('-f', '--files', action='store_true', help='only locate files')
    pa('-g', '--globs', action='store_true', help='match on globs')
    pa('-i', '--ignore-case', action='store_true', help='ignore case in searches')
    pa('-l', '--lsld', action='store_true', help='run "ls -ld" on locations')
    pa('-r', '--real', action='store_true', help='only include real paths')
    pa('-x', '--exclude', type=str, nargs='+', help='exclude paths which match regexp(s)')
    pa('-v', '--verbose', help='Show locate command')
    args = parser.parse_args()
    return args

def main():
    """Main method for calling from bash"""
    args = parse_args()
    located_arg = _locate(args)
    if not located_arg:
        return not os.EX_OK
    if args.lsld:
        ls_commands = [str('ls -ld %r' % str(_)) for _ in located_arg]
        __ = [print(getoutput(_)) for _ in ls_commands]
    else:
        print('\n'.join(located_arg))
    return os.EX_OK

if __name__ == "__main__":
    sys.exit(main())


text:
- /health_test/
    - GET a list of all health tests
- /health_tests/<test>/?uids=<uids>&start_time=<start_time>&end_time=<end_time>
    - GET test results of a particular test with filters
- /health_test/<test>/<uid>/?start_time=<start_time>&end_time=<end_time>&latest=<latest>
    - GET test results of a particular test and uid with filters
- /health_test/<test>/<uid>/
    - POST test results of a particular test and uid

Where:

- <uid> is a unique identifier of an asset.
- <test> is the name of a health test.

And query string arguments:

- <uids> is a comma-separated list of uids (optional).
- <start_time> is a datetime string in ISO 8601 format (optional).
- <end_time> is a datetime string in  ISO 8601 format (optional).
- <latest> is a boolean value that if set to 1 or true will return the latest result in combination with start_time and end_time if provided.
- example: /health_test/heart/?uids=1,2,3&start_time=xxx&end_time=xxx


text:
#include "tensorflow/core/data/service/utils.h"

#include "tensorflow/core/data/service/common.pb.h"
#include "tensorflow/core/lib/io/record_reader.h"
#include "tensorflow/core/lib/io/record_writer.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/errors.h"
#include "tensorflow/core/platform/path.h"

namespace tensorflow {
namespace data {

Status WriteDatasetDef(const std::string& path, const DatasetDef& dataset_def) {
  std::unique_ptr<WritableFile> file;
  TF_RETURN_IF_ERROR(Env::Default()->NewWritableFile(path, &file));
  io::RecordWriter writer(file.get());
  TF_RETURN_IF_ERROR(writer.WriteRecord(dataset_def.SerializeAsString()));
  return Status::OK();
}

Status ReadDatasetDef(const std::string& path, DatasetDef& dataset_def) {
  if (path.empty()) {
    return errors::InvalidArgument("Path is empty");
  }
  TF_RETURN_IF_ERROR(Env::Default()->FileExists(path));
  std::unique_ptr<RandomAccessFile> file;
  TF_RETURN_IF_ERROR(Env::Default()->NewRandomAccessFile(path, &file));
  io::RecordReader reader(file.get());
  uint64 offset = 0;
  tstring record;
  TF_RETURN_IF_ERROR(reader.ReadRecord(&offset, &record));
  if (!dataset_def.ParseFromString(record)) {
    return errors::DataLoss("Failed to parse dataset definition");
  }
  return Status::OK();
}

}  // namespace data
}  // namespace tensorflow


text:
package es.caib.sgtsic.error.bitel;

import es.caib.sgtsic.data.Data;
import es.caib.sgtsic.util.bitel.BitCadena;

import java.sql.SQLException;

import java.util.HashMap;

/**
 * La clase ErrorBaseDatosUpdate representa un error producido por un UPDATE en base de datos.
 * $Id: ErrorBaseDatosUpdate.java,v 1.3 2007/02/08 13:02:31 fros Exp $
 * @author Miguel Angel Nieto
 * @author Paco Ros
 * @author Felipe Benavente
 * @date 05/01/2007
 * @version 3.0
 */
public class ErrorBaseDatosUpdate extends ErrorBaseDatos
{

  /**
   * Constructor de la clase BitError.
   * @param nombreElemento    Nombre del elemento.
   * @param data    Informaci�n de la clase Data.
   * @param sql    Sentencia sql.
   * @param error    Excepci�n/error asociado al error.
   */
  public ErrorBaseDatosUpdate(String nombreElemento, Data data, String sql, SQLException sqle)
  {
    this(nombreElemento, null, data, sql, sqle);
  }

  /**
   * Constructor de la clase BitError.
   * @param nombreElemento    Nombre del elemento.
   * @param data    Informaci�n de la clase Data.
   * @param sql    Sentencia sql.
   * @param id    C�digo del elemento afectado.
   * @param error    Excepci�n/error asociado al error.
   */
  public ErrorBaseDatosUpdate(String nombreElemento, int id, Data data, String sql, SQLException sqle)
  {
    this(nombreElemento, String.valueOf(id), data, sql, sqle);
  }

  /**
   * Constructor de la clase BitError.
   * @param nombreElemento    Nombre del elemento.
   * @param data    Informaci�n de la clase Data.
   * @param sql    Sentencia sql.
   * @param id    C�digo del elemento afectado.
   * @param error    Excepci�n/error asociado al error.
   */
  public ErrorBaseDatosUpdate(String nombreElemento, String id, Data data, String sql, SQLException sqle)
  {
    // Creamos el error con el c�digo del error y la excepci�n asociada
    super("BIT_BD_UPDATE", sqle);

    // Definimos la descripci�n del error
    HashMap descripcion = new HashMap();
    if (id != null){
      descripcion.put(BitError.IDIOMA_ESPANYOL, "Error al actualizar " + nombreElemento + " con c�digo " + id + ".");
      descripcion.put(BitError.IDIOMA_CATALAN , "Error a l'actualitzar " + nombreElemento + " amb codi " + id + ".");
    }
    else{
      descripcion.put(BitError.IDIOMA_ESPANYOL, "Error al actualizar " + nombreElemento + ".");
      descripcion.put(BitError.IDIOMA_CATALAN , "Error a l'actualitzar " + nombreElemento + ".");
    }
    this.setDescripcion(descripcion);

    // Definimos el debug del error
    this.setDebug((String)descripcion.get(BitError.IDIOMA_ESPANYOL)
                  + "\nSQL: " + sql
                  + "\nData: " + data
                  + (id == null ? BitCadena.CADENA_VACIA : ("\nId: " + id)));
  }

}


text:
<!DOCTYPE html>

    <link href="css/awsdocs.css" rel="stylesheet" type="text/css">

    <meta charset="utf-8">

AWS::Route53Resolver::ResolverRuleAssociation

The AWS::Route53Resolver::ResolverRuleAssociation resource contains information about an association between a resolver rule and a
                        VPC.
                        	For more information, see
                        	ResolverRuleAssociation in the
                        	Amazon Route 53 API Reference.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "Type" : "AWS::Route53Resolver::ResolverRuleAssociation",
  "Properties" : {
    "Name" : String,
    "ResolverRuleId" : String,
    "VPCId" : String
  }
}

YAML

Type: "AWS::Route53Resolver::ResolverRuleAssociation"
Properties:
  Name: String
  ResolverRuleId: String
  VPCId: String

Properties

Name

The name of an association between a resolver rule and a VPC.

                                 Required: No

                                 Type: String

                                 Update requires: Replacement

ResolverRuleId

The ID of the resolver rule that you associated with the VPC that is specified by
                                 VPCId.

                                 Required: Yes

                                 Type: String

                                 Update requires: Replacement

VPCId

The ID of the VPC that you associated the resolver rule with.

                                 Required: Yes

                                 Type: String

                                 Update requires: Replacement

Return Values

Ref

When you pass the logical ID of an AWS::Route53Resolver::ResolverRuleAssociation resource to the intrinsic
                        Ref function, the function returns the ResolverRuleAssociationId.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of this type. The following are the available
                        attributes
                        	and sample return values.

Name

The name of an association between a resolver rule and a VPC, such as test.example.com in beta VPC.

ResolverRuleAssociationId

The ID of the resolver rule association that you want to get information about,
                                 		such as rslvr-rrassoc-97242eaf88example.

ResolverRuleId

The ID of the resolver rule that you associated with the VPC that is specified by
                                 VPCId,
                                 		such as rslvr-rr-5328a0899example.

VPCId

The ID of the VPC that you associated the resolver rule with, such as vpc-03cf94c75cexample.

For more information about using Fn::GetAtt, see Fn::GetAtt.

See Also

                                 	ResolverRuleAssociation
                                 	in the Amazon Route 53 API Reference.


text:
require "spec_helper"
require "./lib/tax_calculator"

describe TaxCalculator do
  describe "#calc_tax calculates tax" do
    it "(no rounding up needed)" do
      expect(TaxCalculator.calc_tax(10, 0.15)).to eq 1.50
    end

    it "(rounds up to nearest 0.05)" do
      expect(TaxCalculator.calc_tax(47.50, 0.15)).to eq 7.15
      expect(TaxCalculator.calc_tax(11.25, 0.05)).to eq 0.60
    end
  end
end


text:
module Rack
  class XFrameOptions

    def initialize(app, value = "SAMEORIGIN")
      @app = app
      @value = value.upcase
    end

    def call(env)
      status, headers, body = @app.call(env)

      if headers['Content-Type'] =~ /html/
        headers['X-Frame-Options'] = ["DENY", "SAMEORIGIN"].include?(@value) ? @value : "DENY"
      end

      [status, headers, body]
    end
  end
end