text:
package org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.configure.ui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.wso2.developerstudio.eclipse.gmf.esb.NamespacedProperty;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A SWT based editor dialog to be used for editing namespaced properties.
 */
public class NamespacedPropertyEditorDialog extends Dialog {
	/**
	 * Dialog shell.
	 */
	private Shell dialogShell;

	/**
	 * Group box for separating property value edit area.
	 */
	private Group propertyGroupBox;

	/**
	 * Text field used for manipulating property value.
	 */
	private Text propertyTextField;

	/**
	 * Button used to fire up the xpath editor.
	 */
	private Button selectXpathButton;

	private boolean showDynamicXPathOption;

	private Button chkDynamicXPath;

	private Label lblDynamicDescription;

	private String dynamicXpathDescriptionText = " : This enables the value of XPath to be evaluvated at run time.";

	/**
	 * Group box for separating namespaces edit area.
	 */
	private Group namespacesGroupBox;

	/**
	 * Namespace 'Prefix' label.
	 */
	private Label nsPrefixLabel;

	/**
	 * Namespace prefix text field.
	 */
	private Text nsPrefixTextField;

	/**
	 * Namespace 'URI' label.
	 */
	private Label nsUriLabel;

	/**
	 * Namespace URI text field.
	 */
	private Text nsUriTextField;

	/**
	 * Namespace list box.
	 */
	private List nsListBox;

	/**
	 * Add namespace button.
	 */
	private Button addButton;

	/**
	 * Edit namespace button.
	 */
	private Button editButton;

	/**
	 * Remove namespace button.
	 */
	private Button removeButton;

	/**
	 * Cancel button.
	 */
	private Button cancelButton;

	/**
	 * Ok button.
	 */
	private Button okButton;

	/**
	 * {@link NamespacedProperty} being edited.
	 */
	private NamespacedProperty nsProperty;

	/**
	 * Namespaces collected.
	 */
	private Map<String, String> collectedNamespaces;

	/**
	 * Format string used for displaying namespaces.
	 */
	private static final String namespaceDisplayFormat = "xmlns:%s=\"%s\"";

	/**
	 * Regex pattern used to identify a namespace string.
	 */
	private static final Pattern namespaceDisplayPattern = Pattern
			.compile("xmlns:([^=]++)=.*+");

	/**
	 * Status indicating whether this dialog was saved or cancelled.
	 */
	private boolean saved;

	/**
	 * Status indicating whether the XPath is dynamic.
	 */
	private boolean isDynamicXPath;

	/**
	 * Constructs a new dialog.
	 *
	 * @param parent
	 *            parent shell.
	 * @param style
	 *            style.
	 * @param property
	 *            namespaced property to be manipulated.
	 */
	public NamespacedPropertyEditorDialog(Shell parent,
			NamespacedProperty property) {
		super(parent);
		this.nsProperty = property;
		this.collectedNamespaces = new HashMap<String, String>();
		this.showDynamicXPathOption = property.isSupportsDynamicXPaths();
	}

	// /**
	// * Main function used for testing purposes.
	// *
	// * @param args arguments.
	// */
	// public static void main(String[] args) {
	// Display display = Display.getDefault();
	// Shell shell = new Shell(display);
	// NamespacedPropertyEditorDialog dialog = new
	// NamespacedPropertyEditorDialog(shell, SWT.NULL,
	// EsbFactory.eINSTANCE.createNamespacedProperty());
	// dialog.open();
	// }

	/**
	 * Creates ui components and opens the dialog.
	 */
	public void open() {
		Shell parentShell = getParent();
		dialogShell = new Shell(parentShell, SWT.DIALOG_TRIM
				| SWT.APPLICATION_MODAL);

		// Configure dialog shell internal layout.
		FormLayout dialogShellLayout = new FormLayout();
		dialogShellLayout.marginHeight = 5;
		dialogShellLayout.marginWidth = 5;
		dialogShell.setLayout(dialogShellLayout);

		// Construct and layout property edit box.
		propertyGroupBox = new Group(dialogShell, SWT.NONE);
		{
			propertyGroupBox.setText("Property");
			FormData groupBoxLayoutData = new FormData();
			groupBoxLayoutData.top = new FormAttachment(0);
			groupBoxLayoutData.left = new FormAttachment(0);
			groupBoxLayoutData.right = new FormAttachment(100);
			propertyGroupBox.setLayoutData(groupBoxLayoutData);

			// Configure group box internal layout.
			FormLayout groupBoxLayout = new FormLayout();
			groupBoxLayout.marginWidth = 5;
			groupBoxLayout.marginHeight = 5;
			propertyGroupBox.setLayout(groupBoxLayout);

			// Xpath editor launch button.
			selectXpathButton = new Button(propertyGroupBox, SWT.NONE);
			selectXpathButton.setText("Select XPath");
			FormData selectXpathButtonLayoutData = new FormData();
			selectXpathButtonLayoutData.right = new FormAttachment(100);
			selectXpathButtonLayoutData.top = new FormAttachment(0);
			selectXpathButton.setLayoutData(selectXpathButtonLayoutData);

			// Property editor text field.
			propertyTextField = new Text(propertyGroupBox, SWT.BORDER);
			FormData textFieldLayoutData = new FormData();
			textFieldLayoutData.right = new FormAttachment(selectXpathButton, -5);
			textFieldLayoutData.top = new FormAttachment(selectXpathButton, 0, SWT.CENTER);
			textFieldLayoutData.left = new FormAttachment(0);
			propertyTextField.setLayoutData(textFieldLayoutData);

			if (showDynamicXPathOption) {
				// XPath dynamic option
				chkDynamicXPath = new Button(propertyGroupBox, SWT.CHECK);
				chkDynamicXPath.setText("Dynamic");
				FormData chekboxLayoutData = new FormData();
				chekboxLayoutData.top = new FormAttachment(propertyTextField, 4, SWT.BOTTOM);
				chekboxLayoutData.left = new FormAttachment(propertyTextField, 0, SWT.LEFT);
				chkDynamicXPath.setLayoutData(chekboxLayoutData);

				chkDynamicXPath.addListener(SWT.Selection, new Listener() {
					public void handleEvent(Event event) {
						isDynamicXPath = chkDynamicXPath.getSelection();
					}
				});

				// XPath dynamic option description
				lblDynamicDescription = new Label(propertyGroupBox, SWT.CENTER);
				lblDynamicDescription.setText(dynamicXpathDescriptionText);
				FormData lableLayoutData = new FormData();
				lableLayoutData.top = new FormAttachment(propertyTextField, 8, SWT.BOTTOM);
				lableLayoutData.left = new FormAttachment(chkDynamicXPath, 6, SWT.RIGHT);
				lblDynamicDescription.setLayoutData(lableLayoutData);
			}
		}

		// OK button.
		okButton = new Button(dialogShell, SWT.NONE);
		{
			okButton.setText("OK");
			FormData okButtonLayoutData = new FormData();
			okButtonLayoutData.right = new FormAttachment(100);
			okButtonLayoutData.bottom = new FormAttachment(100);
			okButtonLayoutData.width = 80;
			okButton.setLayoutData(okButtonLayoutData);
		}

		// Cancel button.
		cancelButton = new Button(dialogShell, SWT.NONE);
		{
			cancelButton.setText("Cancel");
			FormData cancelButtonLayoutData = new FormData();
			cancelButtonLayoutData.top = new FormAttachment(okButton, 0,
					SWT.CENTER);
			cancelButtonLayoutData.right = new FormAttachment(okButton, -5);
			cancelButtonLayoutData.width = 80;
			cancelButton.setLayoutData(cancelButtonLayoutData);
		}

		// Construct and layout namespace edit box.
		namespacesGroupBox = new Group(dialogShell, SWT.NONE);
		{
			namespacesGroupBox.setText("Namespaces");
			FormData groupBoxLayoutData = new FormData();
			groupBoxLayoutData.top = new FormAttachment(propertyGroupBox, 5);
			groupBoxLayoutData.left = new FormAttachment(0);
			groupBoxLayoutData.right = new FormAttachment(100);
			groupBoxLayoutData.bottom = new FormAttachment(okButton, -10);
			namespacesGroupBox.setLayoutData(groupBoxLayoutData);

			// Configure group box internal layout.
			FormLayout groupBoxLayout = new FormLayout();
			groupBoxLayout.marginWidth = 5;
			groupBoxLayout.marginHeight = 5;
			namespacesGroupBox.setLayout(groupBoxLayout);

			// Namespace prefix label.
			nsPrefixLabel = new Label(namespacesGroupBox, SWT.NONE);
			{
				nsPrefixLabel.setText("Prefix:");
				FormData nsPrefixLabelLayoutData = new FormData();
				nsPrefixLabelLayoutData.top = new FormAttachment(0);
				nsPrefixLabelLayoutData.left = new FormAttachment(0);
				nsPrefixLabel.setLayoutData(nsPrefixLabelLayoutData);
			}

			// Namespace prefix text field.
			nsPrefixTextField = new Text(namespacesGroupBox, SWT.BORDER);
			{
				FormData nsPrefixTextFieldLayoutData = new FormData();
				nsPrefixTextFieldLayoutData.top = new FormAttachment(
						nsPrefixLabel, 0, SWT.CENTER);
				nsPrefixTextFieldLayoutData.left = new FormAttachment(
						nsPrefixLabel, 5);
				nsPrefixTextFieldLayoutData.width = 100;
				nsPrefixTextField.setLayoutData(nsPrefixTextFieldLayoutData);
			}

			// Namespace URI label.
			nsUriLabel = new Label(namespacesGroupBox, SWT.NONE);
			{
				nsUriLabel.setText("URI:");
				FormData nsUriLabelLayoutData = new FormData();
				nsUriLabelLayoutData.top = new FormAttachment(
						nsPrefixTextField, 0, SWT.CENTER);
				nsUriLabelLayoutData.left = new FormAttachment(
						nsPrefixTextField, 5);
				nsUriLabel.setLayoutData(nsUriLabelLayoutData);
			}

			// Add namespace button.
			addButton = new Button(namespacesGroupBox, SWT.NONE);
			{
				addButton.setText("Add");
				FormData addButtonLayoutData = new FormData();
				addButtonLayoutData.top = new FormAttachment(nsUriLabel, 0,
						SWT.CENTER);
				addButtonLayoutData.right = new FormAttachment(100);
				addButtonLayoutData.width = 80;
				addButton.setLayoutData(addButtonLayoutData);
			}

			// Namespace URI input text field.
			nsUriTextField = new Text(namespacesGroupBox, SWT.BORDER);
			{
				FormData nsUriTextFieldLayoutData = new FormData();
				nsUriTextFieldLayoutData.top = new FormAttachment(nsUriLabel,
						0, SWT.CENTER);
				nsUriTextFieldLayoutData.left = new FormAttachment(nsUriLabel,
						5);
				nsUriTextFieldLayoutData.right = new FormAttachment(addButton,
						-5);
				nsUriTextField.setLayoutData(nsUriTextFieldLayoutData);
			}

			// Edit namespace button.
			editButton = new Button(namespacesGroupBox, SWT.NONE);
			{
				editButton.setText("Edit");
				FormData editButtonLayoutData = new FormData();
				editButtonLayoutData.top = new FormAttachment(addButton, 10);
				editButtonLayoutData.right = new FormAttachment(100);
				editButtonLayoutData.left = new FormAttachment(addButton, 0,
						SWT.LEFT);
				editButton.setLayoutData(editButtonLayoutData);
			}

			// Remove namespace button.
			removeButton = new Button(namespacesGroupBox, SWT.NONE);
			{
				removeButton.setText("Remove");
				FormData removeButtonLayoutData = new FormData();
				removeButtonLayoutData.top = new FormAttachment(editButton, 5);
				removeButtonLayoutData.right = new FormAttachment(100);
				removeButtonLayoutData.left = new FormAttachment(editButton, 0,
						SWT.LEFT);
				removeButton.setLayoutData(removeButtonLayoutData);
			}

			// Namespaces list box.
			nsListBox = new List(namespacesGroupBox, SWT.BORDER);
			{
				FormData nsListBoxFormData = new FormData();
				nsListBoxFormData.top = new FormAttachment(editButton, 0,
						SWT.TOP);
				nsListBoxFormData.left = new FormAttachment(0);
				nsListBoxFormData.right = new FormAttachment(addButton, -5);
				nsListBoxFormData.bottom = new FormAttachment(100);
				nsListBox.setLayoutData(nsListBoxFormData);
			}
		}

		loadConfiguration();
		initActions();
		setTabOrder();

		// Open dialog.
		dialogShell.layout();
		dialogShell.pack();
		dialogShell.setSize(640, 415);
		centerDialog();
		dialogShell.open();
		Display display = dialogShell.getDisplay();
		while (!dialogShell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	private void loadConfiguration() {
		dialogShell.setText(String.format("Namespaced Property Editor",
				nsProperty.getPrettyName()));
		propertyGroupBox.setText(nsProperty.getPrettyName());
		String xpath = nsProperty.getPropertyValue();
		if (xpath != null) {
			if (showDynamicXPathOption){
				isDynamicXPath = nsProperty.isDynamic();
				chkDynamicXPath.setSelection(isDynamicXPath);
			}
			propertyTextField.setText(xpath);
		}

		for (Entry<String, String> nsEntry : nsProperty.getNamespaces().entrySet()) {
			addNamespace(nsEntry.getKey(), nsEntry.getValue());
		}
	}

	private void initActions() {
		selectXpathButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				XPathSelectorDialog xpathEditorDialog = new XPathSelectorDialog(
						dialogShell);
				xpathEditorDialog.open();
				if (xpathEditorDialog.getSelectedXpath() != null) {
					propertyTextField.setText(xpathEditorDialog
							.getSelectedXpath());
					collectedNamespaces.clear();
					nsListBox.removeAll();
					for (Entry<String, String> nsEntry: xpathEditorDialog.getNameSpaces().entrySet()) {
						addNamespace(nsEntry.getKey(), nsEntry.getValue());
					}
				}
			}
		});

		addButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				String prefix = nsPrefixTextField.getText();
				String uri = nsUriTextField.getText();
				if (isValidNamespace(prefix, uri)) {
					addNamespace(prefix, uri);
					nsPrefixTextField.setText("");
					nsUriTextField.setText("");
					nsPrefixTextField.setFocus();
				} else {
					// TODO: Report invalid namespace here.
				}
			}
		});

		removeButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				for (String selection : nsListBox.getSelection()) {
					removeNamespace(selection);
				}
			}
		});

		editButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				String[] selection = nsListBox.getSelection();
				if (selection.length > 0) {
					String selectedNamespace = selection[0];
					String prefix = extractPrefix(selectedNamespace);
					String uri = collectedNamespaces.get(prefix);
					if (null != uri) {
						collectedNamespaces.remove(prefix);
						nsPrefixTextField.setText(prefix);
						nsUriTextField.setText(uri);
						nsPrefixTextField.setFocus();
					}
					nsListBox.remove(selectedNamespace);
				}
			}
		});

		okButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				try {
					saveConfiguration();
					setSaved(true);
				} catch (Exception ex) {
					// TODO: Report validation error here.
				}
				dialogShell.dispose();
			}
		});

		cancelButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				setSaved(false);
				dialogShell.dispose();
			}
		});
	}

	private boolean isValidNamespace(String prefix, String uri) {
		// TODO: Perform proper validation here.
		if (prefix == null || uri == null
				|| collectedNamespaces.containsKey(prefix)) {
			return false;
		} else if (prefix.isEmpty() || uri.isEmpty()) {
			return false;
		}
		return true;
	}

	private void addNamespace(String prefix, String uri) {
		collectedNamespaces.put(prefix, uri);
		String namespaceDisplayValue = String.format(namespaceDisplayFormat,
				prefix, uri);
		nsListBox.add(namespaceDisplayValue);
	}

	private void removeNamespace(String namespace) {
		nsListBox.remove(namespace);
		String prefix = extractPrefix(namespace);
		if (prefix != null && !prefix.isEmpty()) {
			collectedNamespaces.remove(prefix);
		}
	}

	private String extractPrefix(String namespace) {
		Matcher matcher = namespaceDisplayPattern.matcher(namespace);
		if (matcher.find()) {
			return matcher.group(1);
		}
		return null;
	}

	private void centerDialog() {
		Rectangle parentBounds = getParent().getBounds();
		Rectangle dialogBounds = dialogShell.getBounds();
		int centerX, centerY;
		centerX = (parentBounds.width - dialogBounds.width) / 2
				+ parentBounds.x;
		centerY = (parentBounds.height - dialogBounds.height) / 2
				+ parentBounds.y;
		dialogShell.setLocation(new Point(centerX, centerY));
	}

	private void setTabOrder() {
		Control[] tabOrder = new Control[] { propertyTextField,
				selectXpathButton };
		propertyGroupBox.setTabList(tabOrder);

		tabOrder = new Control[] { nsPrefixTextField, nsUriTextField, addButton };
		namespacesGroupBox.setTabList(tabOrder);

		tabOrder = new Control[] { propertyGroupBox, namespacesGroupBox,
				okButton };
		dialogShell.setTabList(tabOrder);
	}

	private void saveConfiguration() throws Exception {
		nsProperty.setPropertyValue(propertyTextField.getText());
		nsProperty.getNamespaces().clear();
		nsProperty.getNamespaces().putAll(collectedNamespaces);
		nsProperty.setDynamic(isDynamicXPath);
	}

	private void setSaved(boolean saved) {
		this.saved = saved;
	}

	public boolean isSaved() {
		return saved;
	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="This is Delhi University Community Radio Official website.">
    <meta name="author" content="Vineet">

    <title>Delhi University Community Radio</title>

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

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css">

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

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

Admin Panel

            <button type="button" class="btn btn-info btn-lg">Manage Archives</button>
            <button type="button" class="btn btn-info btn-lg">Manage Schedule</button>
            <button type="button" class="btn btn-info btn-lg">Manage Gallery</button>
            <button type="button" class="btn btn-info btn-lg">Manage Team</button>
            <button type="button" class="btn btn-info btn-lg">Manage Notification</button>

<button type="button" class="btn btn-primary active">Upload a New photo</button>

<button type="button" class="btn btn-primary active">Delete a photo</button>
<button type="button" class="btn btn-primary active">Edit Description</button>

    Upload a thumbnail

    Select fileChange<input type="file" name="...">
    Remove

    Upload bigger Photo

    Select fileChange<input type="file" name="...">
    Remove

          Description:

            <textarea class="form-control" rows="1" id="description"></textarea>

redpajama_set_name: RedPajamaGithub


text:
class BusinessesController < ApplicationController
  before_action :set_business, only: [:show, :edit, :update, :destroy]

  # GET /businesses
  # GET /businesses.json
  def index
    @businesses = Business.all
  end

  # GET /businesses/1
  # GET /businesses/1.json
  def show
  end

  # GET /businesses/new
  def new
    @business = Business.new
  end

  # GET /businesses/1/edit
  def edit
  end

  # POST /businesses
  # POST /businesses.json
  def create
    @business = Business.new(business_params)

    respond_to do |format|
      if @business.save
        format.html { redirect_to @business, notice: 'Business was successfully created.' }
        format.json { render :show, status: :created, location: @business }
      else
        format.html { render :new }
        format.json { render json: @business.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /businesses/1
  # PATCH/PUT /businesses/1.json
  def update
    respond_to do |format|
      if @business.update(business_params)
        format.html { redirect_to @business, notice: 'Business was successfully updated.' }
        format.json { render :show, status: :ok, location: @business }
      else
        format.html { render :edit }
        format.json { render json: @business.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /businesses/1
  # DELETE /businesses/1.json
  def destroy
    @business.destroy
    respond_to do |format|
      format.html { redirect_to businesses_url, notice: 'Business was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_business
      @business = Business.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def business_params
      params.require(:business).permit(:name, :website, :leader_id)
    end
end


text:
@implementation GHPUsersViewController

#pragma mark - setters and getters

- (NSString *)emptyArrayErrorMessage {
    return NSLocalizedString(@"No Users available", @"");
}

#pragma mark - Table view data source

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"GHPUserTableViewCell";

    GHPUserTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[GHPUserTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    [self setupDefaultTableViewCell:cell forRowAtIndexPath:indexPath];

    GHAPIUserV3 *user = [self.dataArray objectAtIndex:indexPath.row];

    [self updateImageView:cell.imageView atIndexPath:indexPath withAvatarURLString:user.avatarURL];
    cell.textLabel.text = user.login;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}

#pragma mark - Table view delegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return GHPUserTableViewCellHeight;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    GHAPIUserV3 *user = [self.dataArray objectAtIndex:indexPath.row];
    GHPUserViewController *userViewController = [[GHPUserViewController alloc] initWithUsername:user.login];
    [self.advancedNavigationController pushViewController:userViewController afterViewController:self animated:YES];
}

@end


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>HELLOWORK</title>
  <link rel="stylesheet" href="./style.css">

<form>
  <input w2b-model="model_first_name" type="text" class="feedback-input" placeholder="First Name"/>
  <input w2b-model="model_last_name" type="text" class="feedback-input" placeholder="Last Name"/>
  <textarea w2b-model="model_comment" class="feedback-input" placeholder="Comment"></textarea>
  <button type="button" class="submit-btn" onclick="setData()">Set Data</button>(first name: Verminator, last name: Le, comment: Just write some comment).
</form>

Result:

First name:

Last name:

Comment:


text:
package com.ckfinder.connector.handlers.command;

import java.io.File;

import org.w3c.dom.Element;

import com.ckfinder.connector.configuration.Constants;
import com.ckfinder.connector.errors.ConnectorException;
import com.ckfinder.connector.utils.AccessControlUtil;
import com.ckfinder.connector.utils.FileUtils;

/**
 * Class to handle DeleteFolder command.
 */
public class DeleteFolderCommand extends XMLCommand implements IPostCommand{

	@Override
	protected void createXMLChildNodes(final int errorNum, final Element rootElement)
															throws ConnectorException {

	}

	/**
	 * @return error code or 0 if ok. Deletes folder and thumb folder.
	 */
	@Override
	protected int getDataForXml() {

		if (!AccessControlUtil.getInstance(this.configuration)
													.checkFolderACL(this.type,
																	this.currentFolder,
																	this.userRole,
							AccessControlUtil.CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
			return Constants.Errors.CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED;
		}
		if (this.currentFolder.equals("/")) {
			return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST;
		}

		if (FileUtils.checkIfDirIsHidden(this.currentFolder, configuration)) {
			return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST;
		}

		File dir = new File(configuration.getTypes().get(this.type).getPath()
												 + this.currentFolder);

		try {
			if (!dir.exists() || !dir.isDirectory()) {
				return Constants.Errors.CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND;
			}

			if (FileUtils.delete(dir)) {
				File thumbDir = new File(configuration.getThumbsPath()
														+ File.separator
														+ type
														+ this.currentFolder);
				FileUtils.delete(thumbDir);
			} else {
				return Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
			}
		} catch (SecurityException e) {
			if (configuration.isDebugMode()) {
				throw e;
			} else {
				return Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
			}
		}

		return Constants.Errors.CKFINDER_CONNECTOR_ERROR_NONE;
	}

}


text:
#include "stdafx.h"
#include "DemoScreenLevelFile.h"

DemoScreenLevelFile::DemoScreenLevelFile()
{
}

void DemoScreenLevelFile::Start()
{
	//Loads the file from Config\ActorDef\level_demo.lua
	// Level files automatically add their actors to the world.
	theWorld.LoadLevel("level_demo");

	//Since the Actors were just added directly to the world,
	//  we don't have handles to them. The level definition
	//  gave them the tag "spawned," so we can get them that way.
	ActorSet spawnedActors = theTagList.GetObjectsTagged("spawned");
	ActorSet::iterator it = spawnedActors.begin();
	while (it != spawnedActors.end())
	{
		//Can check Individual actors for tags as well.
		if ((*it)->IsTagged("left-tilted"))
		{
			(*it)->SetRotation(25.0f);
		}
		else if ((*it)->IsTagged("right-tilted"))
		{
			(*it)->SetRotation(-25.0f);
		}
		//Applying tags
		(*it)->Tag("rotated");

		//Removing tags
		(*it)->Untag("spawned");
		it++;
	}

	//Demo housekeeping below this point.
	#pragma region Demo housekeeping
	t = new TextActor("Console", "These Actors were placed and tagged (\"left-tilted\"");
	t->SetPosition(0, 5.5);
	t->SetAlignment(TXT_Center);
	theWorld.Add(t);
	t2 = new TextActor("Console", "and \"right-tilted\") using a level definition file.");
	t2->SetPosition(0, 4.5);
	t2->SetAlignment(TXT_Center);
	theWorld.Add(t2);
	t3 = new TextActor("Console", "Then their rotations were set based on those tags.");
	t3->SetPosition(0, -4.5);
	t3->SetAlignment(TXT_Center);
	theWorld.Add(t3);
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenLevelFile.cpp, level_demo.lua");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(t2);
	_objects.push_back(t3);
	it = spawnedActors.begin();
	while (it != spawnedActors.end())
	{
		_objects.push_back(*it);
		it++;
	}
	#pragma endregion
}


text:
package org.jetbrains.plugins.scala
package lang
package psi
package stubs
package index

import java.util.Collection

import _root_.org.jetbrains.plugins.scala.lang.psi.impl.search.ScSourceFilterScope
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.{StringStubIndexExtension, StubIndexKey}
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunction

/**
 * User: Alexander Podkhalyuzin
 * Date: 14.10.2008
 */

class ScFunctionNameIndex extends StringStubIndexExtension[ScFunction] {
  override def get(key: String, project: Project, scope: GlobalSearchScope): Collection[ScFunction] =
    super.get(key, project, new ScSourceFilterScope(scope, project))

  def getKey: StubIndexKey[String, ScFunction] = ScFunctionNameIndex.KEY
}

object ScFunctionNameIndex {
  val KEY = ScalaIndexKeys.METHOD_NAME_KEY
}


text:
<?php

namespace AppBundle\Controller;

use AppBundle\Service\TemplateAware;

class FrontController
{
    use TemplateAware;

    /**
     * Homepage
     */
    public function homeAction()
    {
        return $this->render('AppBundle:Front:home.html.twig', []);
    }

}


text:
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"

#include "src/gpu/ganesh/GrOpFlushState.h"
#include "src/gpu/ganesh/GrOpsRenderPass.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrResourceProvider.h"

GrMeshDrawOp::GrMeshDrawOp(uint32_t classID) : INHERITED(classID) {}

void GrMeshDrawOp::onPrepare(GrOpFlushState* state) { this->onPrepareDraws(state); }

void GrMeshDrawOp::createProgramInfo(GrMeshDrawTarget* target) {
    this->createProgramInfo(&target->caps(),
                            target->allocator(),
                            target->writeView(),
                            target->usesMSAASurface(),
                            target->detachAppliedClip(),
                            target->dstProxyView(),
                            target->renderPassBarriers(),
                            target->colorLoadOp());
}

bool GrMeshDrawOp::CombinedQuadCountWillOverflow(GrAAType aaType,
                                                 bool willBeUpgradedToAA,
                                                 int combinedQuadCount) {
    bool willBeAA = (aaType == GrAAType::kCoverage) || willBeUpgradedToAA;

    return combinedQuadCount > (willBeAA ? GrResourceProvider::MaxNumAAQuads()
                                         : GrResourceProvider::MaxNumNonAAQuads());
}

// This onPrepareDraws implementation assumes the derived Op only has a single programInfo -
// which is the majority of the cases.
void GrMeshDrawOp::onPrePrepareDraws(GrRecordingContext* context,
                                     const GrSurfaceProxyView& writeView,
                                     GrAppliedClip* clip,
                                     const GrDstProxyView& dstProxyView,
                                     GrXferBarrierFlags renderPassXferBarriers,
                                     GrLoadOp colorLoadOp) {
    SkArenaAlloc* arena = context->priv().recordTimeAllocator();

    // http://skbug.com/12201 -- DDL does not yet support DMSAA.
    bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;

    // This is equivalent to a GrOpFlushState::detachAppliedClip
    GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();

    this->createProgramInfo(context->priv().caps(), arena, writeView, usesMSAASurface,
                            std::move(appliedClip), dstProxyView, renderPassXferBarriers,
                            colorLoadOp);

    // TODO: at this point we've created both the program info and desc in the recording context's
    // arena. In the DDL case, it would be cool if 'recordProgramInfo' could return the
    // pre-existing versions if the program has already been seen. We could then return the
    // memory for the current copy to the arena.
    context->priv().recordProgramInfo(this->programInfo());
}

//////////////////////////////////////////////////////////////////////////////

GrMeshDrawOp::PatternHelper::PatternHelper(GrMeshDrawTarget* target, GrPrimitiveType primitiveType,
                                           size_t vertexStride, sk_sp<const GrBuffer> indexBuffer,
                                           int verticesPerRepetition, int indicesPerRepetition,
                                           int repeatCount, int maxRepetitions) {
    this->init(target, primitiveType, vertexStride, std::move(indexBuffer), verticesPerRepetition,
               indicesPerRepetition, repeatCount, maxRepetitions);
}

void GrMeshDrawOp::PatternHelper::init(GrMeshDrawTarget* target, GrPrimitiveType primitiveType,
                                       size_t vertexStride, sk_sp<const GrBuffer> indexBuffer,
                                       int verticesPerRepetition, int indicesPerRepetition,
                                       int repeatCount, int maxRepetitions) {
    SkASSERT(target);
    if (!indexBuffer) {
        return;
    }
    sk_sp<const GrBuffer> vertexBuffer;
    int firstVertex;
    int vertexCount = verticesPerRepetition * repeatCount;
    fVertices = target->makeVertexSpace(vertexStride, vertexCount, &vertexBuffer, &firstVertex);
    if (!fVertices) {
        SkDebugf("Vertices could not be allocated for patterned rendering.");
        return;
    }
    SkASSERT(vertexBuffer);
    fMesh = target->allocMesh();
    fPrimitiveType = primitiveType;

    SkASSERT(maxRepetitions ==
             static_cast<int>(indexBuffer->size() / (sizeof(uint16_t) * indicesPerRepetition)));
    fMesh->setIndexedPatterned(std::move(indexBuffer), indicesPerRepetition, repeatCount,
                               maxRepetitions, std::move(vertexBuffer), verticesPerRepetition,
                               firstVertex);
}

void GrMeshDrawOp::PatternHelper::recordDraw(GrMeshDrawTarget* target,
                                             const GrGeometryProcessor* gp) const {
    target->recordDraw(gp, fMesh, 1, fPrimitiveType);
}

void GrMeshDrawOp::PatternHelper::recordDraw(
        GrMeshDrawTarget* target,
        const GrGeometryProcessor* gp,
        const GrSurfaceProxy* const primProcProxies[]) const {
    target->recordDraw(gp, fMesh, 1, primProcProxies, fPrimitiveType);
}

//////////////////////////////////////////////////////////////////////////////

GrMeshDrawOp::QuadHelper::QuadHelper(GrMeshDrawTarget* target,
                                     size_t vertexStride,
                                     int quadsToDraw) {
    sk_sp<const GrGpuBuffer> indexBuffer = target->resourceProvider()->refNonAAQuadIndexBuffer();
    if (!indexBuffer) {
        SkDebugf("Could not get quad index buffer.");
        return;
    }
    this->init(target, GrPrimitiveType::kTriangles, vertexStride, std::move(indexBuffer),
               GrResourceProvider::NumVertsPerNonAAQuad(),
               GrResourceProvider::NumIndicesPerNonAAQuad(), quadsToDraw,
               GrResourceProvider::MaxNumNonAAQuads());
}


text:
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// tests for header storage in httpd.js; nsHttpHeaders is an *internal* data
// structure and is not to be used directly outside of httpd.js itself except
// for testing purposes

/**
 * Ensures that a fieldname-fieldvalue combination is a valid header.
 *
 * @param fieldName
 *   the name of the header
 * @param fieldValue
 *   the value of the header
 * @param headers
 *   an nsHttpHeaders object to use to check validity
 */
function assertValidHeader(fieldName, fieldValue, headers)
{
  try
  {
    headers.setHeader(fieldName, fieldValue, false);
  }
  catch (e)
  {
    do_throw("Unexpected exception thrown: " + e);
  }
}

/**
 * Ensures that a fieldname-fieldvalue combination is not a valid header.
 *
 * @param fieldName
 *   the name of the header
 * @param fieldValue
 *   the value of the header
 * @param headers
 *   an nsHttpHeaders object to use to check validity
 */
function assertInvalidHeader(fieldName, fieldValue, headers)
{
  try
  {
    headers.setHeader(fieldName, fieldValue, false);
    throw "Setting (" + fieldName + ", " +
          fieldValue + ") as header succeeded!";
  }
  catch (e)
  {
    if (e !== Cr.NS_ERROR_INVALID_ARG)
      do_throw("Unexpected exception thrown: " + e);
  }
}

function run_test()
{
  testHeaderValidity();
  testGetHeader();
  testHeaderEnumerator();
  testHasHeader();
}

function testHeaderValidity()
{
  var headers = new nsHttpHeaders();

  assertInvalidHeader("f o", "bar", headers);
  assertInvalidHeader("f\0n", "bar", headers);
  assertInvalidHeader("foo:", "bar", headers);
  assertInvalidHeader("f\\o", "bar", headers);
  assertInvalidHeader("@xml", "bar", headers);
  assertInvalidHeader("fiz(", "bar", headers);
  assertInvalidHeader("HTTP/1.1", "bar", headers);
  assertInvalidHeader("b\"b", "bar", headers);
  assertInvalidHeader("ascsd\t", "bar", headers);
  assertInvalidHeader("{fds", "bar", headers);
  assertInvalidHeader("baz?", "bar", headers);
  assertInvalidHeader("a\\b\\c", "bar", headers);
  assertInvalidHeader("\0x7F", "bar", headers);
  assertInvalidHeader("\0x1F", "bar", headers);
  assertInvalidHeader("f\n", "bar", headers);
  assertInvalidHeader("foo", "b\nar", headers);
  assertInvalidHeader("foo", "b\rar", headers);
  assertInvalidHeader("foo", "b\0", headers);

  // request splitting, fwiw -- we're actually immune to this type of attack so
  // long as we don't implement persistent connections
  assertInvalidHeader("f\r\nGET /badness HTTP/1.1\r\nFoo", "bar", headers);

  assertValidHeader("f'", "baz", headers);
  assertValidHeader("f`", "baz", headers);
  assertValidHeader("f.", "baz", headers);
  assertValidHeader("f---", "baz", headers);
  assertValidHeader("---", "baz", headers);
  assertValidHeader("~~~", "baz", headers);
  assertValidHeader("~~~", "b\r\n bar", headers);
  assertValidHeader("~~~", "b\r\n\tbar", headers);
}

function testGetHeader()
{
  var headers = new nsHttpHeaders();

  headers.setHeader("Content-Type", "text/html", false);
  var c = headers.getHeader("content-type");
  do_check_eq(c, "text/html");

  headers.setHeader("test", "FOO", false);
  var c = headers.getHeader("test");
  do_check_eq(c, "FOO");

  try
  {
    headers.getHeader(":");
    throw "Failed to throw for invalid header";
  }
  catch (e)
  {
    if (e !== Cr.NS_ERROR_INVALID_ARG)
      do_throw("headers.getHeader(':') must throw invalid arg");
  }

  try
  {
    headers.getHeader("valid");
    throw 'header doesn\'t exist';
  }
  catch (e)
  {
    if (e !== Cr.NS_ERROR_NOT_AVAILABLE)
      do_throw("shouldn't be a header named 'valid' in headers!");
  }
}

function testHeaderEnumerator()
{
  var headers = new nsHttpHeaders();

  var heads =
    {
      "foo": "17",
      "baz": "two six niner",
      "decaf": "class Program { int .7; int main(){ .7 = 5; return 7 - .7; } }"
    };

  for (var i in heads)
    headers.setHeader(i, heads[i], false);

  var en = headers.enumerator;
  while (en.hasMoreElements())
  {
    var it = en.getNext().QueryInterface(Ci.nsISupportsString).data;
    do_check_true(it.toLowerCase() in heads);
    delete heads[it.toLowerCase()];
  }

  for (var i in heads)
    do_throw("still have properties in heads!?!?");

}

function testHasHeader()
{
  var headers = new nsHttpHeaders();

  headers.setHeader("foo", "bar", false);
  do_check_true(headers.hasHeader("foo"));
  do_check_true(headers.hasHeader("fOo"));
  do_check_false(headers.hasHeader("not-there"));

  headers.setHeader("f`'~", "bar", false);
  do_check_true(headers.hasHeader("F`'~"));

  try
  {
    headers.hasHeader(":");
    throw "failed to throw";
  }
  catch (e)
  {
    if (e !== Cr.NS_ERROR_INVALID_ARG)
      do_throw(".hasHeader for an invalid name should throw");
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Destrier.Redis.Cache
{
    [RedisStore(RedisCache.Constants.RootKey)]
    public class RedisCacheItem
    {
        [RedisKey]
        public String Key { get; set; }

        public DateTime Created { get; set; }
        public DateTime? LastAccessed { get; set; }
        public DateTime? Expiration { get; set; }
        public long? SlidingExpirationSeconds { get; set; }

        [RedisBinarySerialize]
        public Object Value { get; set; }

        public bool Locked { get; set; }
        public string LockedBy { get; set; }

        public long ValueSizeBytes { get; set; }
    }
}


text:
@charset "utf-8";@import url('/common/css/lib/animate.css');@import url('/common/css/base.min.css');@import url('/common/css/lower.min.css');.yomikomu article{}
.yomikomu #browsing{position:relative;text-align:center;}
.yomikomu #browsing button{margin-top:1em;padding:0.8em 2em 1em;background:#eee;border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #ccc;border-bottom:1px solid #ccc;box-shadow:-1px -1px 1px rgba(000,000,000,0.2),1px 1px 1px rgba(255,255,255,1);cursor:pointer;}
.yomikomu #browsing #loading{width:100%;padding:4% 0 2%;display:none;}
.yomikomu #browsing #loading img{width:auto;margin:0 auto;}
.yomikomu #browsing .pages{width:auto;margin:20px auto 0;opacity:0;border:1px solid #ccc;}
.yomikomu #hamburger+label{background:#fff;}
.yomikomu #hamburger:checked+label{background:transparent;}
@media screen and (max-width:1000px){.yomikomu #browsing .pages{width:100%;}}


text:
import imp

class Drivers:

    def getDriver(self, args, frequency, pulse_incr_us):

        if ('rpio' == args.driver):
            try:
                imp.find_module('RPIO')
                from theapipantilt.drivers.rpiodriver import RPIOServoControl as ServoControl
            except ImportError:
                from theapipantilt.drivers.dummydriver import DummyServoControl as ServoControl

            return ServoControl(frequency, pulse_incr_us)

        elif ('cube' == args.driver):
            try:
                from theapipantilt.drivers.cube import CubeServoControl as ServoControl
            except ImportError:
                from theapipantilt.drivers.dummydriver import DummyServoControl as ServoControl

            return ServoControl(frequency, pulse_incr_us)

        else:
            from theapipantilt.drivers.dummydriver import DummyServoControl as ServoControl
            return ServoControl(frequency, pulse_incr_us)


text:
describe('Sails.js Sequelize hook test suite', () => {

    const decache = require('decache');

    let clean = () => {
        decache('./unit/create.test');
        decache('./unit/associations.test');
        decache('./unit/scope.test');
    };

    require('./bootstrap.v0.11.test');
    clean();

    require('./bootstrap.v0.12.test');
    clean();

    require('./bootstrap.v1.x.test');
    clean();

    require('./bootstrap.v1.x-many-schemes.test');
    clean();

    require('./bootstrap.v1.x-create-db-schemes.test');
    clean();

    // this test should run after bootstrap.v1.x-create-db-schemes because it doesn't create tables
    require('./bootstrap.v1.x-migrate-safe.test');
    clean();

    require('./bootstrap.v1.x-sqlite.test');
    clean();

    require('./bootstrap.v1.x-no-conn.test');
    clean();

    require('./bootstrap.v1.x-sequelize-waterline.test');
    clean();

});


text:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements;
 * and to You under the Apache License, Version 2.0.
 */
package ch.sbb.releasetrain.state;

import static org.junit.Assert.*;

import ch.sbb.releasetrain.config.model.releaseconfig.ActionConfig;
import ch.sbb.releasetrain.config.model.releaseconfig.JenkinsActionConfig;
import ch.sbb.releasetrain.state.model.ReleaseState;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

/**
 * @author u206123 (Florian Seidl)
 * @since 0.0.6, 2016.
 */
public class StateFileWriterReaderTest {

	@Rule
	public TemporaryFolder temporaryFolder = new TemporaryFolder();

	@Test
	public void testWriteState() throws IOException {
		ReleaseState releaseState = new ReleaseState("test", Collections.<ActionConfig>emptyList());
		new StateFileWriter(temporaryFolder.getRoot()).write(releaseState);
		assertTrue(new File(temporaryFolder.getRoot(), "test-state.yml").exists());
	}

	@Test
	public void testWriteReadState() throws IOException {
		ReleaseState releaseState = new ReleaseState("test", Collections.<ActionConfig>emptyList());
		new StateFileWriter(temporaryFolder.getRoot()).write(releaseState);
		assertNotNull(new StateFileReader(temporaryFolder.getRoot()).read("test"));
	}

	@Test
	public void testWriteReadStateEqual() throws IOException {
		ReleaseState releaseState = new ReleaseState("test", Collections.<ActionConfig>emptyList());
		new StateFileWriter(temporaryFolder.getRoot()).write(releaseState);
		ReleaseState releaseStateReread = new StateFileReader(temporaryFolder.getRoot()).read("test");
		assertEquals(releaseState, releaseStateReread);
	}

	@Test
	public void testWriteReadStateWithActionStatesEqual() throws IOException {
		ReleaseState releaseState = new ReleaseState("test", Arrays.asList(createActionConfig("bli", 0), createActionConfig("bla", 3), createActionConfig("blo", 1)));

		new StateFileWriter(temporaryFolder.getRoot()).write(releaseState);
		ReleaseState releaseStateReread = new StateFileReader(temporaryFolder.getRoot()).read("test");
		assertEquals(releaseState, releaseStateReread);
	}

	private ActionConfig createActionConfig(final String name, final int nrProperties) {
		final ActionConfig actionConfig = new JenkinsActionConfig();
		actionConfig.setOffseMinutes(42);
		final Map<String, String> properties = new HashMap<>();
		for (int i = 0; i < nrProperties; i++) {
			properties.put(String.format("property%d", i), String.format("value%d", i));
		}
		actionConfig.setProperties(properties);
		return actionConfig;
	}

}


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

#include "ash/wm/gestures/wm_gesture_handler.h"

#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/notifier_catalogs.h"
#include "ash/public/cpp/system/toast_data.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/toast/toast_manager_impl.h"
#include "ash/wm/desks/desks_controller.h"
#include "ash/wm/desks/desks_histogram_enums.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/screen_pinning_controller.h"
#include "ash/wm/window_cycle/window_cycle_controller.h"
#include "base/metrics/user_metrics.h"
#include "base/time/time.h"
#include "components/prefs/pref_service.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_types.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h"
#include "ui/message_center/public/cpp/notifier_id.h"

namespace ash {

namespace {

constexpr char kEnterOverviewToastId[] = "ash.wm.reverse_enter_overview_toast";
constexpr char kExitOverviewToastId[] = "ash.wm.reverse_exit_overview_toast";
constexpr char kSwitchNextDeskToastId[] = "ash.wm.reverse_next_desk_toast";
constexpr char kSwitchLastDeskToastId[] = "ash.wm.reverse_last_desk_toast";

// Check if the user used the wrong gestures.
bool g_did_wrong_enter_overview_gesture = false;
bool g_did_wrong_exit_overview_gesture = false;
bool g_did_wrong_next_desk_gesture = false;
bool g_did_wrong_last_desk_gesture = false;

// Is the reverse scrolling for touchpad on.
bool IsNaturalScrollOn() {
  PrefService* pref =
      Shell::Get()->session_controller()->GetActivePrefService();
  return pref->GetBoolean(prefs::kTouchpadEnabled) &&
         pref->GetBoolean(prefs::kNaturalScroll);
}

// Reverse an offset when the reverse scrolling is on.
float GetOffset(float offset) {
  // The handler code uses the new directions which is the reverse of the old
  // handler code. Reverse the offset if the ReverseScrollGestures feature is
  // disabled so that the users get old behavior.
  if (!features::IsReverseScrollGesturesEnabled())
    return -offset;
  return IsNaturalScrollOn() ? -offset : offset;
}

void ShowReverseGestureToast(const char* toast_id,
                             ToastCatalogName catalog_name,
                             int message_id) {
  Shell::Get()->toast_manager()->Show(
      ToastData(toast_id, catalog_name, l10n_util::GetStringUTF16(message_id)));
}

// When reverse scrolling for touchpad is Off, if the user performs wrong
// vertical gestures (i.e., swiping down/up with three fingers to enter/exit
// overview), a toast will show up to tell user the correct gesture. The toast
// will be removed after M89.
bool MaybeHandleWrongVerticalGesture(float offset_y, bool in_overview) {
  const bool correct_gesture = in_overview ? (offset_y < 0) : (offset_y > 0);

  if (!features::IsReverseScrollGesturesEnabled() || IsNaturalScrollOn())
    return correct_gesture;

  bool* const did_wrong_ptr = in_overview ? &g_did_wrong_exit_overview_gesture
                                          : &g_did_wrong_enter_overview_gesture;
  const char* toast_id =
      in_overview ? kExitOverviewToastId : kEnterOverviewToastId;

  if (correct_gesture) {
    *did_wrong_ptr = false;
    Shell::Get()->toast_manager()->Cancel(toast_id);
    return true;
  }

  if (*did_wrong_ptr) {
    ShowReverseGestureToast(
        toast_id,
        in_overview ? ToastCatalogName::kExitOverviewGesture
                    : ToastCatalogName::kEnterOverviewGesture,
        in_overview ? IDS_CHANGE_EXIT_OVERVIEW_REVERSE_GESTURE
                    : IDS_CHANGE_ENTER_OVERVIEW_REVERSE_GESTURE);
  } else {
    *did_wrong_ptr = true;
  }

  return false;
}

// Handles vertical 3-finger scroll gesture by entering overview on scrolling
// up, and exiting it on scrolling down. If entering overview and window cycle
// list is open, close the window cycle list.
// Returns true if the gesture was handled.
bool Handle3FingerVerticalScroll(float scroll_y) {
  if (std::fabs(scroll_y) < WmGestureHandler::kVerticalThresholdDp)
    return false;

  auto* overview_controller = Shell::Get()->overview_controller();
  const bool in_overview = overview_controller->InOverviewSession();

  if (!MaybeHandleWrongVerticalGesture(GetOffset(scroll_y), in_overview))
    return false;

  if (in_overview) {
    base::RecordAction(base::UserMetricsAction("Touchpad_Gesture_Overview"));
    if (overview_controller->AcceptSelection())
      return true;
    overview_controller->EndOverview(OverviewEndAction::k3FingerVerticalScroll);
  } else {
    auto* window_cycle_controller = Shell::Get()->window_cycle_controller();
    if (window_cycle_controller->IsCycling())
      window_cycle_controller->CancelCycling();

    base::RecordAction(base::UserMetricsAction("Touchpad_Gesture_Overview"));
    overview_controller->StartOverview(
        OverviewStartAction::k3FingerVerticalScroll);
  }

  return true;
}

// When reverse scrolling for touchpad is Off, if the user performs wrong
// horizontal gestures (i.e., swiping left/right with four fingers to switch to
// the next/previous desk), a toast will show up to tell user the correct
// gesture. The toast will be removed after M89.
void MaybeHandleWrongHorizontalGesture(bool move_left,
                                       const Desk* previous_desk,
                                       const Desk* next_desk) {
  if (!features::IsReverseScrollGesturesEnabled() || IsNaturalScrollOn())
    return;

  // Perform wrong gesture on the first desk.
  if (move_left && next_desk && !previous_desk) {
    if (!g_did_wrong_next_desk_gesture) {
      g_did_wrong_next_desk_gesture = true;
    } else {
      ShowReverseGestureToast(kSwitchNextDeskToastId,
                              ToastCatalogName::kNextDeskGesture,
                              IDS_CHANGE_NEXT_DESK_REVERSE_GESTURE);
    }
    return;
  }

  // Perform wrong gesture on the last desk.
  if (!move_left && !next_desk && previous_desk) {
    if (!g_did_wrong_last_desk_gesture) {
      g_did_wrong_last_desk_gesture = true;
    } else {
      ShowReverseGestureToast(kSwitchLastDeskToastId,
                              ToastCatalogName::kPreviousDeskGesture,
                              IDS_CHANGE_LAST_DESK_REVERSE_GESTURE);
    }
    return;
  }

  g_did_wrong_next_desk_gesture = false;
  g_did_wrong_last_desk_gesture = false;

  auto* toast_manager = Shell::Get()->toast_manager();
  toast_manager->Cancel(kSwitchNextDeskToastId);
  toast_manager->Cancel(kSwitchLastDeskToastId);
}

}  // namespace

WmGestureHandler::WmGestureHandler() = default;

WmGestureHandler::~WmGestureHandler() = default;

bool WmGestureHandler::ProcessScrollEvent(const ui::ScrollEvent& event) {
  // Disable touchpad swipe when screen is pinned.
  if (Shell::Get()->screen_pinning_controller()->IsPinned())
    return false;

  // ET_SCROLL_FLING_CANCEL means a touchpad swipe has started.
  if (event.type() == ui::ET_SCROLL_FLING_CANCEL) {
    scroll_data_ = ScrollData();
    return false;
  }

  // ET_SCROLL_FLING_START means a touchpad swipe has ended.
  if (event.type() == ui::ET_SCROLL_FLING_START) {
    bool success = EndScroll();
    DCHECK(!scroll_data_);
    return success;
  }
  DCHECK_EQ(ui::ET_SCROLL, event.type());

  return ProcessEventImpl(event.finger_count(), event.x_offset(),
                          event.y_offset());
}

bool WmGestureHandler::ProcessEventImpl(int finger_count,
                                        float delta_x,
                                        float delta_y) {
  if (!scroll_data_)
    return false;

  // Only three or four finger scrolls are supported.
  if (finger_count != 3 && finger_count != 4) {
    scroll_data_.reset();
    return false;
  }

  // There is a finger switch, end the current gesture.
  if (scroll_data_->finger_count != 0 &&
      scroll_data_->finger_count != finger_count) {
    scroll_data_.reset();
    return false;
  }

  scroll_data_->scroll_x += delta_x;
  scroll_data_->scroll_y += delta_y;

  // If the requirements to move the overview selector are met, reset
  // |scroll_data_|.
  const bool moved = MoveOverviewSelection(finger_count, scroll_data_->scroll_x,
                                           scroll_data_->scroll_y);

  if (finger_count == 4) {
    DCHECK(!moved);
    // Horizontal gesture may be flipped.
    const float offset_x = GetOffset(-delta_x);
    const float scroll_x = GetOffset(scroll_data_->scroll_x);
    auto* desks_controller = DesksController::Get();
    // Update the continuous desk animation if it has already been started,
    // otherwise start it if it passes the threshold.
    if (scroll_data_->continuous_gesture_started) {
      desks_controller->UpdateSwipeAnimation(offset_x);
    } else if (std::abs(scroll_x) > kContinuousGestureMoveThresholdDp) {
      if (!desks_controller->StartSwipeAnimation(/*move_left=*/offset_x > 0)) {
        // Starting an animation failed. This can happen if we are on the
        // lockscreen or an ongoing animation from a different source is
        // happening. In this case reset |scroll_data_| and wait for the next 4
        // finger swipe.
        scroll_data_.reset();
        return false;
      }

      MaybeHandleWrongHorizontalGesture(
          /*move_left=*/scroll_x < 0,
          desks_controller->GetPreviousDesk(/*use_target_active_desk=*/false),
          desks_controller->GetNextDesk(/*use_target_active_desk=*/false));

      scroll_data_->continuous_gesture_started = true;
    }
  }

  if (moved)
    scroll_data_ = ScrollData();
  scroll_data_->finger_count = finger_count;
  return moved;
}

bool WmGestureHandler::EndScroll() {
  if (!scroll_data_)
    return false;

  const int finger_count = scroll_data_->finger_count;
  const float scroll_x = scroll_data_->scroll_x;
  const float scroll_y = scroll_data_->scroll_y;
  const bool continuous_gesture_started =
      scroll_data_->continuous_gesture_started;
  scroll_data_.reset();

  if (finger_count == 0)
    return false;

  if (finger_count == 3) {
    if (std::fabs(scroll_x) < std::fabs(scroll_y))
      return Handle3FingerVerticalScroll(scroll_y);

    return MoveOverviewSelection(finger_count, scroll_x, scroll_y);
  }

  if (finger_count != 4)
    return false;

  if (continuous_gesture_started)
    DesksController::Get()->EndSwipeAnimation();

  return continuous_gesture_started;
}

bool WmGestureHandler::MoveOverviewSelection(int finger_count,
                                             float scroll_x,
                                             float scroll_y) {
  if (finger_count != 3)
    return false;

  auto* overview_controller = Shell::Get()->overview_controller();
  const bool in_overview = overview_controller->InOverviewSession();
  if (!ShouldHorizontallyScroll(in_overview, scroll_x, scroll_y))
    return false;

  overview_controller->IncrementSelection(/*forward=*/scroll_x > 0);
  return true;
}

bool WmGestureHandler::ShouldHorizontallyScroll(bool in_session,
                                                float scroll_x,
                                                float scroll_y) {
  // Dominantly vertical scrolls and small horizontal scrolls do not move the
  // selector.
  if (!in_session || std::fabs(scroll_x) < std::fabs(scroll_y))
    return false;

  if (std::fabs(scroll_x) < kHorizontalThresholdDp)
    return false;

  return true;
}

}  // namespace ash


text:
<ListView android:id="@+id/id_listview"
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingBottom="@dimen/activity_vertical_margin"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:paddingTop="@dimen/activity_vertical_margin"
          tools:context="com.imooc.android_percent_support.ListViewTestActivity">

</ListView>


text:
package com.google.gson.internal;

/**
 * A simple utility class used to check method Preconditions.
 *
 * <pre>
 * public long divideBy(long value) {
 *   Preconditions.checkArgument(value != 0);
 *   return this.value / value;
 * }
 * </pre>
 *
 * @author Inderjeet Singh
 * @author Joel Leitch
 */
public final class $Gson$Preconditions {
  public static <T> T checkNotNull(T obj) {
    if (obj == null) {
      throw new NullPointerException();
    }
    return obj;
  }

  public static void checkArgument(boolean condition) {
    if (!condition) {
      throw new IllegalArgumentException();
    }
  }
}


text:
@import url(vendors/bootstrap.css);             /*Bootstrap base CSS*/
@import url(fonts/font-faces.css);         		/*font-faces.css*/
@import url(vendors/font-awesome.css);         	/*font-awesome.css*/
@import url(vendors/magnific-popup.css);
@import url(vendors/mediaelementplayer.css);

@import url(../masterslider/style/masterslider.css); /*Base MasterSlider style sheet*/
@import url(../masterslider/skins/default/style.css); /*Base MasterSlider style sheet*/

@import url(style.css);          	   /*template style*/

/*@import url(styles/skin1.css);*/
/*@import url(styles/skin2.css);*/


text:
'use strict';
var isString = require('lodash').isString;
var React = require('react/addons');

var formatters = require('./formatters');
var predicates = require('./predicates');

module.exports = React.createClass({
    displayName: 'Search',

    propTypes: {
        columns: React.PropTypes.array,
        data: React.PropTypes.array,
        onChange: React.PropTypes.func,
    },

    getDefaultProps() {
        return {
            columns: [],
            data: [],
            onChange: () => {},
        };
    },

    getInitialState() {
        return {
            column: 'all',
            query: ''
        };
    },

    getOptions() {
        var columns = this.props.columns;
        return [{
            value: 'all',
            name: 'All'
        }].concat(columns.map((column) => {
              if(column.property && column.header) {
                  return {
                      value: column.property,
                      name: column.header
                  };
              }
        }).filter((a) => a));
    },

    render() {
        return (
            <span className='search'>
                <select onChange={this.onColumnChange} value={this.state.column}>{this.getOptions().map((option) =>
                    <option key={option.value + '-option'} value={option.value}>{option.name}</option>
                )
                }</select>
                <input onChange={this.onQueryChange} value={this.state.query}></input>
            </span>
        );
    },

    onColumnChange(event) {
        var column = event.target.value;
        var query = this.state.query;
        this.setState({
            column: column
        });

        this.props.onChange({
            column: column,
            query: query,
        });
    },

    onQueryChange(event) {
        var column = this.state.column;
        var query = event.target.value;
        this.setState({
            query: query
        });

        this.props.onChange({
            column: column,
            query: query,
        });
    },

    componentDidMount() {
        this.props.onChange({
            column: this.state.column,
            query: this.state.query
        });
    },
});

module.exports.search = (data, columns, column, query, options) => {
    if(!query) {
        return data;
    }

    options = options || {
        strategy: predicates.infix,
        transform: formatters.lowercase
    };

    if(column !== 'all') {
        columns = columns.filter((col) =>
            col.property === column
        );
    }

    return data.filter((row) =>
        columns.filter(isColumnVisible.bind(this, row)).length > 0
    );

    function isColumnVisible(row, col) {
        var property = col.property;
        var value = row[property];
        var formatter = col.search || formatters.identity;
        var formattedValue = formatter(value);

        if (!formattedValue) {
            return false;
        }

        if (!isString(formattedValue)) {
            formattedValue = formattedValue.toString();
        }

        var predicate = options.strategy(options.transform(query));

        return predicate.evaluate(options.transform(formattedValue));
    }
};

module.exports.matches = (column, value, query, options) => {
    if(!query) {
        return {};
    }

    options = options || {
        strategy: predicates.infix,
        transform: formatters.lowercase
    };

    var predicate = options.strategy(options.transform(query));

    return predicate.matches(options.transform(value));
};


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>Web documentaire Paris vu par... Le contraste</title>
        <meta name="description" content="Webdocumentaire sur Paris vu par... 50 ans après !">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-icon-57x57.png">
        <link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-icon-60x60.png">
        <link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-icon-72x72.png">
        <link rel="apple-touch-icon" sizes="76x76" href="img/favicon/apple-icon-76x76.png">
        <link rel="apple-touch-icon" sizes="114x114" href="img/favicon/apple-icon-114x114.png">
        <link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-icon-120x120.png">
        <link rel="apple-touch-icon" sizes="144x144" href="img/favicon/apple-icon-144x144.png">
        <link rel="apple-touch-icon" sizes="152x152" href="img/favicon/apple-icon-152x152.png">
        <link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-icon-180x180.png">
        <link rel="icon" type="image/png" sizes="192x192"  href="img/favicon/android-icon-192x192.png">
        <link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="96x96" href="img/favicon/favicon-96x96.png">
        <link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
        <link rel="manifest" href="img/favicon/manifest.json">
        <meta name="msapplication-TileColor" content="#ffffff">
        <meta name="msapplication-TileImage" content="img/favicon/ms-icon-144x144.png">
        <meta name="theme-color" content="#ffffff">

        <link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Amatic+SC:400,700' type='text/css'>
        <link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Advent+Pro:400,700' type='text/css'>
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="jquery/css/jquery-ui.min.css">
        <link rel="stylesheet" href="jquery/css/jquery-ui.structure.min.css">
        <link rel="stylesheet" href="jquery/css/jquery-ui.theme.min.css">
        <link rel="stylesheet" href="css/custom.css">

Paris vu par...

Le contraste

            Commencer l'aventure


text:
package org.onosproject.provider.of.link.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.link.LinkDescription;
import org.onosproject.net.link.LinkProvider;
import org.onosproject.net.link.LinkProviderRegistry;
import org.onosproject.net.link.LinkProviderService;
import org.onosproject.net.provider.AbstractProviderService;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.openflow.controller.Dpid;
import org.onosproject.openflow.controller.OpenFlowPacketContext;
import org.onosproject.openflow.controller.OpenFlowSwitch;
import org.onosproject.openflow.controller.OpenFlowSwitchListener;
import org.onosproject.openflow.controller.OpenflowControllerAdapter;
import org.onosproject.openflow.controller.PacketListener;
import org.onosproject.openflow.controller.RoleState;
import org.onlab.packet.Ethernet;
import org.onlab.packet.ONLabLddp;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFPortConfig;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import org.projectfloodlight.openflow.protocol.OFPortReason;
import org.projectfloodlight.openflow.protocol.OFPortStatus;
import org.projectfloodlight.openflow.protocol.ver10.OFFactoryVer10;
import org.projectfloodlight.openflow.types.OFPort;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public class OpenFlowLinkProviderTest {

    private static final DeviceId DID1 = DeviceId.deviceId("of:0000000000000001");
    private static final DeviceId DID2 = DeviceId.deviceId("of:0000000000000002");

    private static final Dpid DPID2 = Dpid.dpid(DID2.uri());
    private static final Dpid DPID1 = Dpid.dpid(DID1.uri());

    private static final OFPortDesc PD1 = portDesc(1, true);
    private static final OFPortDesc PD2 = portDesc(2, true);
    private static final OFPortDesc PD3 = portDesc(1, true);
    private static final OFPortDesc PD4 = portDesc(2, true);

    private static final List<OFPortDesc> PLIST1 = Lists.newArrayList(PD1, PD2);
    private static final List<OFPortDesc> PLIST2 = Lists.newArrayList(PD3, PD4);

    private static final TestOpenFlowSwitch SW1 = new TestOpenFlowSwitch(DPID1, PLIST1);
    private static final TestOpenFlowSwitch SW2 = new TestOpenFlowSwitch(DPID2, PLIST2);

    private final OpenFlowLinkProvider provider = new OpenFlowLinkProvider();
    private final TestLinkRegistry linkService = new TestLinkRegistry();
    private final TestController controller = new TestController();

    private TestLinkProviderService providerService;
    private TestPacketContext pktCtx;

    @Before
    public void setUp() {
        pktCtx = new TestPacketContext(DPID2);
        provider.providerRegistry = linkService;
        controller.switchMap.put(DPID1, SW1);
        controller.switchMap.put(DPID2, SW2);
        provider.controller = controller;
        provider.activate();
    }

    @Test
    public void basics() {
        assertNotNull("registration expected", providerService);
        assertEquals("incorrect provider", provider, providerService.provider());
    }

    @Test
    public void switchAdd() {
        controller.listener.switchAdded(DPID1);
        assertFalse("Device not added", provider.discoverers.isEmpty());
    }

    @Test
    public void switchRemove() {
        controller.listener.switchAdded(DPID1);
        controller.listener.switchRemoved(DPID1);

        assertTrue("Discoverer is not gone", provider.discoverers.isEmpty());
        assertTrue("Device is not gone.", vanishedDpid(DPID1));
    }

    @Test
    public void portUp() {
        controller.listener.switchAdded(DPID1);
        controller.listener.portChanged(DPID1, portStatus(true, 3));

        assertTrue("Port not added to discoverer",
                provider.discoverers.get(DPID1).ports.containsKey(3));
    }

    @Test
    public void portDown() {
        controller.listener.switchAdded(DPID1);
        controller.listener.portChanged(DPID1, portStatus(false, 1));

        assertFalse("Port added to discoverer",
                provider.discoverers.get(DPID1).ports.containsKey(1));
        assertTrue("Port is not gone.", vanishedPort((long) 1));
    }

    @Test
    public void portUnknown() {
        controller.listener.switchAdded(DPID1);
        controller.listener.portChanged(DPID2, portStatus(false, 1));

        assertNull("DPID exists",
                provider.discoverers.get(DPID2));
    }

    @Test
    public void unknownPktCtx() {
        controller.pktListener.handlePacket(pktCtx);

        assertFalse("Context should still be free", pktCtx.isHandled());
    }

    @Test
    public void knownPktCtx() {
        controller.listener.switchAdded(DPID1);
        controller.listener.switchAdded(DPID2);

        controller.pktListener.handlePacket(pktCtx);

        assertTrue("Link not detected", detectedLink(DPID1, DPID2));

    }

    @After
    public void tearDown() {
        provider.deactivate();
        provider.providerRegistry = null;
        provider.controller = null;
    }

    private OFPortStatus portStatus(boolean up, int port) {
        OFPortDesc desc = portDesc(port, up);
        OFPortStatus status = OFFactoryVer10.INSTANCE.buildPortStatus()
                .setDesc(desc)
                .setReason(up ? OFPortReason.ADD : OFPortReason.DELETE).build();
        return status;

    }

    private static OFPortDesc portDesc(int port, boolean up) {
        OFPortDesc.Builder builder = OFFactoryVer10.INSTANCE.buildPortDesc();
        builder.setPortNo(OFPort.of(port));
        if (!up) {
            builder.setConfig(Collections.singleton(OFPortConfig.PORT_DOWN));
        }
        return builder.build();
    }

    private boolean vanishedDpid(Dpid... dpids) {
        for (int i = 0; i < dpids.length; i++) {
            if (!providerService.vanishedDpid.contains(dpids[i])) {
                return false;
            }
        }
        return true;
    }

    private boolean vanishedPort(Long... ports) {
        for (int i = 0; i < ports.length; i++) {
            if (!providerService.vanishedPort.contains(ports[i])) {
                return false;
            }
        }
        return true;
    }

    private boolean detectedLink(Dpid src, Dpid dst) {
        for (Dpid key : providerService.discoveredLinks.keySet()) {
            if (key.equals(src)) {
                return providerService.discoveredLinks.get(src).equals(dst);
            }
        }
        return false;
    }

    private class TestLinkRegistry implements LinkProviderRegistry {

        @Override
        public LinkProviderService register(LinkProvider provider) {
            providerService = new TestLinkProviderService(provider);
            return providerService;
        }

        @Override
        public void unregister(LinkProvider provider) {
        }

        @Override
        public Set<ProviderId> getProviders() {
            return null;
        }

    }

    private class TestLinkProviderService
    extends AbstractProviderService<LinkProvider>
    implements LinkProviderService {

        List<Dpid> vanishedDpid = Lists.newLinkedList();
        List<Long> vanishedPort = Lists.newLinkedList();
        Map<Dpid, Dpid> discoveredLinks = Maps.newHashMap();

        protected TestLinkProviderService(LinkProvider provider) {
            super(provider);
        }

        @Override
        public void linkDetected(LinkDescription linkDescription) {
            Dpid sDpid = Dpid.dpid(linkDescription.src().deviceId().uri());
            Dpid dDpid = Dpid.dpid(linkDescription.dst().deviceId().uri());
            discoveredLinks.put(sDpid, dDpid);
        }

        @Override
        public void linkVanished(LinkDescription linkDescription) {
        }

        @Override
        public void linksVanished(ConnectPoint connectPoint) {
            vanishedPort.add(connectPoint.port().toLong());

        }

        @Override
        public void linksVanished(DeviceId deviceId) {
            vanishedDpid.add(Dpid.dpid(deviceId.uri()));
        }

    }

    private class TestController extends OpenflowControllerAdapter {
        PacketListener pktListener;
        OpenFlowSwitchListener listener;
        Map<Dpid, OpenFlowSwitch> switchMap = new HashMap<Dpid, OpenFlowSwitch>();

        @Override
        public void addPacketListener(int priority, PacketListener listener) {
            pktListener = listener;
        }

        @Override
        public void removePacketListener(PacketListener listener) {
            pktListener = null;
        }

        @Override
        public void addListener(OpenFlowSwitchListener listener) {
            this.listener = listener;
        }

        @Override
        public void removeListener(OpenFlowSwitchListener listener) {
            this.listener = null;
        }

        @Override
        public void processPacket(Dpid dpid, OFMessage msg) {
            OpenFlowPacketContext ctx = new TestPacketContext(dpid);
            pktListener.handlePacket(ctx);
        }

        @Override
        public Iterable<OpenFlowSwitch> getSwitches() {
            return Collections.emptyList();
        }

        @Override
        public OpenFlowSwitch getSwitch(Dpid dpid) {
            return switchMap.get(dpid);
        }
    }

    private class TestPacketContext implements OpenFlowPacketContext {

        protected Dpid swid;
        protected boolean blocked = false;

        public TestPacketContext(Dpid dpid) {
            swid = dpid;
        }

        @Override
        public boolean block() {
            blocked = true;
            return blocked;
        }

        @Override
        public void send() {
        }

        @Override
        public void build(OFPort outPort) {
        }

        @Override
        public void build(Ethernet ethFrame, OFPort outPort) {
        }

        @Override
        public Ethernet parsed() {
            return null;
        }

        @Override
        public byte[] unparsed() {
            ONLabLddp lldp = new ONLabLddp();
            lldp.setSwitch(DPID1.value());

            Ethernet ethPacket = new Ethernet();
            ethPacket.setEtherType(Ethernet.TYPE_LLDP);
            ethPacket.setDestinationMACAddress(ONLabLddp.LLDP_NICIRA);
            ethPacket.setPayload(lldp);
            ethPacket.setPad(true);

            lldp.setPort(PD1.getPortNo().getPortNumber());
            ethPacket.setSourceMACAddress(PD1.getHwAddr().getBytes());
            return ethPacket.serialize();

        }

        @Override
        public Dpid dpid() {
            return swid;
        }

        @Override
        public Integer inPort() {
            return PD3.getPortNo().getPortNumber();
        }

        @Override
        public boolean isHandled() {
            return blocked;
        }

        @Override
        public boolean isBuffered() {
            return false;
        }

    }

    private static class TestOpenFlowSwitch implements OpenFlowSwitch {

        private final List<OFPortDesc> ports;
        private final Dpid dpid;

        public TestOpenFlowSwitch(Dpid dpid, List<OFPortDesc> ports) {
            this.ports = ports;
            this.dpid = dpid;
        }

        RoleState state;
        List<OFMessage> sent = new ArrayList<OFMessage>();
        OFFactory factory = OFFactoryVer10.INSTANCE;

        @Override
        public void sendMsg(OFMessage msg) {
            sent.add(msg);
        }

        @Override
        public void sendMsg(List<OFMessage> msgs) {
        }

        @Override
        public void handleMessage(OFMessage fromSwitch) {
        }

        @Override
        public void setRole(RoleState role) {
            state = role;
        }

        @Override
        public RoleState getRole() {
            return state;
        }

        @Override
        public List<OFPortDesc> getPorts() {
            return ports;
        }

        @Override
        public OFFactory factory() {
            return factory;
        }

        @Override
        public String getStringId() {
            return null;
        }

        @Override
        public long getId() {
            return dpid.value();
        }

        @Override
        public String manfacturerDescription() {
            return null;
        }

        @Override
        public String datapathDescription() {
            return null;
        }

        @Override
        public String hardwareDescription() {
            return null;
        }

        @Override
        public String softwareDescription() {
            return null;
        }

        @Override
        public String serialNumber() {
            return null;
        }

        @Override
        public boolean isConnected() {
            return true;
        }

        @Override
        public void disconnectSwitch() {
        }

        @Override
        public boolean isOptical() {
            return false;
        }

        @Override
        public void returnRoleReply(RoleState requested, RoleState reponse) {
        }

        @Override
        public String channelId() {
            return "1.2.3.4:1";
        }

    }
}


text:
<?php

namespace app\modules\person\controllers;

use yii;
use app\controllers\BillController;
use app\modules\person\models\EjectHistory;
use app\library\bill\Constant;
use app\library\bill\Util;
use yii\web\Response;

class EjectHistoryChartController extends BillController
{
    public $enableCsrfValidation = false;

    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionAjaxEjectHistoryPeriod()
    {
        $params = yii::$app->request->get('params', array());
        $startDate = (isset($params['day_start_date']) && Util::validDate($params['day_start_date']))
            ? trim($params['day_start_date']) : date('Y-m-d', strtotime('-1 year'));
        $endDate = (isset($params['day_end_date']) && Util::validDate($params['day_end_date']))
            ? trim($params['day_end_date']) : '';
        $data = [];
        $types = $this->_getEjectTypes();
        foreach ($types as $typeName => $type) {
            $ejectData = EjectHistory::getTotalEjectHistoryDataByDay($startDate, $endDate, $type);
            $typeData = [];
            $previousTimestamp = 0;
            foreach ($ejectData as $ejctKey => $ejectValue) {
                $currentTimestamp = strtotime($ejectValue['period'] . ' 08:00:00');
                $typeData[] = [
                    $currentTimestamp * 1000,
                    ($ejctKey > 0 ? (intval($currentTimestamp - $previousTimestamp) / Constant::DAY_SECONDS) : 0),
                ];
                $previousTimestamp = $currentTimestamp;
            }
            $data[] = [
                'name' => $typeName,
                'data' => $typeData,
            ];
        }

        $jsonArray = [
            'searchData' => [
                'startDate' => $startDate,
                'endDate' => $endDate,
            ],
            'data' => $data
        ];

        Yii::$app->response->format = Response::FORMAT_JSON;
        return $jsonArray;
    }

    public function actionAjaxEjectHistoryMonth()
    {
        $params = yii::$app->request->get('params', array());
        $startDate = (isset($params['month_start_date']) && Util::validDate($params['month_start_date']))
            ? trim($params['month_start_date']) : date('Y-m', strtotime('-11 month')) . '-01';
        $endDate = (isset($params['month_end_date']) && Util::validDate($params['month_end_date']))
            ? trim($params['month_end_date']) : '';
        $data = [
            'months' => [],
            'data' => [],
        ];

        $types = $this->_getEjectTypes();
        $months = [];
        $tempData = [];
        foreach ($types as $typeName => $type) {
            $typeData = [];
            $monthData = EjectHistory::getTotalEjectHistoryGroupData($startDate, $endDate, $type);
            foreach ($monthData as $monthValue) {
                $typeData[] = intval($monthValue['number']);
                if (!in_array($monthValue['period'], $months)) {
                    $months[] = $monthValue['period'];
                }
                $typeData[$monthValue['period']] = $monthValue['number'];
            }
            $tempData[$typeName] = $typeData;
        }

        $data['months'] = Util::getMonthRange($months);

        foreach ($types as $typeName => $type) {
            $typeData = [];
            foreach ($data['months'] as $month) {
                if (isset($tempData[$typeName][$month])) {
                    $typeData[] = intval($tempData[$typeName][$month]);
                } else {
                    $typeData[] = 0;
                }
            }
            $data['data'][] = [
                'name' => $typeName,
                'data' => $typeData,
            ];
        }
        $jsonArray = [
            'searchData' => [
                'startDate' => $startDate,
                'endDate' => $endDate,
            ],
            'data' => $data
        ];

        Yii::$app->response->format = Response::FORMAT_JSON;
        return $jsonArray;
    }

    private function _getEjectTypes()
    {
        $types = [
            'Dream' => Constant::EJECT_TYPE_DREAM,
            'Bad' => Constant::EJECT_TYPE_BAD,
        ];
        return $types;
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Microsoft Azure Search Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Search Management APIs.")]

[assembly: AssemblyVersion("1.0.0.60")]
[assembly: AssemblyFileVersion("1.18.0.0")]

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]