text:
<?php
require("dbinfo.php");

// Start XML file, create parent node
$doc = new DOMDocument('1.0', 'iso-8859-1');
$node = $doc->createElement("markers");
$parnode = $doc->appendChild($node);

// Opens a connection to a MySQL server
$connection=mysqli_connect('localhost', $username, $password, $database);
if (!$connection) {
  die('Not connected : ' . mysqli_connect_error());
}
// Set the active MySQL database
$db_selected = mysqli_select_db($connection, $database);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysqli_connect_error());
}

// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysqli_query($connection, $query);
if (!$result) {
  die('Invalid query: ' . mysqli_connect_error());
}

header("Content-type: text/xml");

// Iterate through the rows, adding XML nodes for each
while ($row = @mysqli_fetch_assoc($result)){
  // Add to XML document node
  $node = $doc->createElement("marker");
  $newnode = $parnode->appendChild($node);
  $newnode->setAttribute("name", $row['name']);
  $newnode->setAttribute("address", $row['address']);
  $newnode->setAttribute("lat", $row['lat']);
  $newnode->setAttribute("lng", $row['lng']);
  $newnode->setAttribute("type", $row['type']);
}

$doc->formatOutput = true;
$xmlfile = $doc->saveXML();
$doc->save("markers.xml");
echo $xmlfile;

?>

redpajama_set_name: RedPajamaGithub


text:
<md-chip selected="true" color="accent" class="score">
  {{team.name}} - {{teamScore()}}
</md-chip>


text:
import { bindAll } from 'underscore';
import { Model } from '../../common';
import { hasWin } from '../../utils/mixins';

let CodeMirror: any;

if (hasWin()) {
  CodeMirror = require('codemirror/lib/codemirror');
  require('codemirror/mode/htmlmixed/htmlmixed');
  require('codemirror/mode/css/css');
  require('codemirror-formatting');
}

export default class CodeMirrorEditor extends Model {
  editor?: any;
  element?: HTMLElement;

  defaults() {
    return {
      input: '',
      label: '',
      codeName: '',
      theme: 'hopscotch',
      readOnly: true,
      lineNumbers: true,
    };
  }

  init(el: HTMLElement) {
    bindAll(this, 'onChange');
    this.editor = CodeMirror.fromTextArea(el, {
      dragDrop: false,
      lineWrapping: true,
      mode: this.get('codeName'),
      ...this.attributes,
    });
    this.element = el;
    this.editor.on('change', this.onChange);

    return this;
  }

  onChange() {
    this.trigger('update', this);
  }

  getEditor() {
    return this.editor;
  }

  /**
   * The element where the viewer is attached
   * @return {HTMLElement}
   */
  getElement() {
    return this.element;
  }

  /**
   * Set the element which contains the viewer attached.
   * Generally, it should be just a textarea, but some editor might require
   * a container for it some in that case this method can be used
   * @param {HTMLElement} el
   * @return {self}
   */
  setElement(el: HTMLElement) {
    this.element = el;
    return this;
  }

  /**
   * Refresh the viewer
   * @return {self}
   */
  refresh() {
    this.getEditor().refresh();
    return this;
  }

  /**
   * Focus the viewer
   * @return {self}
   */
  focus() {
    this.getEditor().focus();
    return this;
  }

  getContent() {
    const ed = this.getEditor();
    return ed && ed.getValue();
  }

  /** @inheritdoc */
  setContent(value: string, opts: any = {}) {
    const { editor } = this;
    if (!editor) return;
    editor.setValue(value);

    if (editor.autoFormatRange) {
      CodeMirror.commands.selectAll(editor);
      editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
      CodeMirror.commands.goDocStart(editor);
    }

    !opts.noRefresh && setTimeout(() => this.refresh());
  }
}

// @ts-ignore
CodeMirrorEditor.prototype.CodeMirror = CodeMirror;


text:
package cn.lizhaoweb.spring.netspider.bean;

import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.lizhaoweb.common.util.base.StringUtil;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;

/**
 *
模型 - 种子

 *
 * @author 李召(John.Lee)
 * @version 1.0.0.0.1
 * @notes Created on 2017年06月13日

 * Revision of last commit:$Revision$

 * Author of last commit:$Author$

 * Date of last commit:$Date$

 */
@Data
@NoArgsConstructor
public class Seed {

    /**
     * 地址。
     */
    private String url;

    /**
     * 深度。
     */
    private int deep;

    /**
     * URL 对象。
     */
    @Setter(value = AccessLevel.PRIVATE)
    private URL urlObject;

    /**
     * 有参构造。
     *
     * @param url  URL 地址
     * @param deep 深度
     */
    public Seed(String url, int deep) {
        this.setUrl(url);
        this.setDeep(deep);
    }

    /**
     * 设置 URL 地址。
     *
     * @param url URL 地址
     */
    public void setUrl(String url) {
        this.url = url;
        try {
            this.urlObject = new URL(url);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 获取网站根 URL。
     *
     * @return String
     */
    public String getWebSiteRoot() {
        StringBuilder urlStringBuffer = new StringBuilder();
        urlStringBuffer.append(this.urlObject.getProtocol()).append("://");
        urlStringBuffer.append(this.urlObject.getHost());
        if (this.urlObject.getPort() > 0) {
            urlStringBuffer.append(":").append(this.urlObject.getPort());
        }
        return urlStringBuffer.toString();
    }

    /**
     * 获取保存路径。
     *
     * @return String
     */
    public String getWebSiteSavePath() {
        StringBuffer savePath = new StringBuffer();
        savePath.append(this.urlObject.getHost());
        if (this.urlObject.getPort() > 0) {
            savePath.append("[").append(this.urlObject.getPort()).append("]/");
        } else {
            savePath.append("/");
        }
        if (StringUtil.isNotBlank(this.urlObject.getQuery())) {
            savePath.append(this.urlObject.getQuery());
        }
        savePath.append(UUID.randomUUID());
        return savePath.toString();
    }
}


text:
package org.apache.causeway.testdomain.model.actnsemantics;

import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Editing;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.Property;
import org.apache.causeway.applib.annotation.PropertyLayout;
import org.apache.causeway.applib.value.Blob;
import org.apache.causeway.applib.value.NamedWithMimeType.CommonMimeType;
import org.apache.causeway.commons.internal.base._Bytes;
import org.apache.causeway.commons.internal.resources._Resources;

import lombok.Getter;
import lombok.Setter;
import lombok.val;
import lombok.extern.log4j.Log4j2;

@XmlRootElement(name = "BlobDemo")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@Named("regressiontests.BlobDemo")
@DomainObject(nature=Nature.VIEW_MODEL)
@Log4j2
public class BlobDemo {

    public void initDefaults() {

        try {
            val bytes = _Bytes.of(_Resources.load(BlobDemo.class, "causeway-logo-568x286.png"));
            logo = Blob.of("causeway-logo-56x64", CommonMimeType.PNG, bytes);
        } catch (Exception e) {
            log.error("failed to create Blob from image resource", e);
        }

    }

    // -- EDITABLE

    @Property(editing=Editing.ENABLED)
    @PropertyLayout
    @XmlElement @XmlJavaTypeAdapter(Blob.JaxbToStringAdapter.class)
    @Getter @Setter private Blob logo;

}


text:
UPGRADE FROM 3.x to 4.0
=======================

DependencyInjection
-------------------

 * Using unsupported configuration keys in YAML configuration files raises an
   exception.

 * Using unsupported options to configure service aliases raises an exception.

Form
----

 * The `choices_as_values` option of the `ChoiceType` has been removed.
 * Support for data objects that implements both `Traversable` and
   `ArrayAccess` in `ResizeFormListener::preSubmit` method has been removed

HttpKernel
----------

 * Possibility to pass objects as URI attributes to the ESI and SSI renderers
   has been removed. The inline fragment renderer should be used with object attributes.

Serializer
----------

 * The ability to pass a Doctrine `Cache` instance to the `ClassMetadataFactory`
   class has been removed. You should use the `CacheClassMetadataFactory` class
   instead.

Yaml
----

 * Starting an unquoted string with `%` leads to a `ParseException`.

 * The `Dumper::setIndentation()` method was removed. Pass the indentation
   level to the constructor instead.

 * Removed support for passing `true`/`false` as the second argument to the
   `parse()` method to trigger exceptions when an invalid type was passed.

   Before:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', true);
   ```

   After:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
   ```

 * Removed support for passing `true`/`false` as the third argument to the
   `parse()` method to toggle object support.

   Before:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', false, true);
   ```

   After:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_OBJECT);
   ```

 * Removed support for passing `true`/`false` as the fourth argument to the
   `parse()` method to parse objects as maps.

   Before:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', false, false, true);
   ```

   After:

   ```php
   Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_OBJECT_FOR_MAP);
   ```

 * Removed support for passing `true`/`false` as the fourth argument to the
   `dump()` method to trigger exceptions when an invalid type was passed.

   Before:

   ```php
   Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);
   ```

   After:

   ```php
   Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
   ```

 * Removed support for passing `true`/`false` as the fifth argument to the `dump()` method to toggle object support.

   Before:

   ```php
   Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
   ```

   After:

   ```php
   Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, Yaml::DUMP_OBJECT);
   ```

 * The `!!php/object` tag to indicate dumped PHP objects was removed in favor of
   the `!php/object` tag.

Validator
---------

 * The `DateTimeValidator::PATTERN` constant was removed.


text:
layout: styleguide
title: Styleguide Navigation
slug: sg-navigation
lead: "Styleguide for brand usage"
base_url: "../../"
---

Navigation

          Integration und Verwendungsbeispiele

Responsive Navigation als Navigationsleiste für das Portal. Unterteilt in 6 farblich markierte Bereiche.
    Die Leiste klappt in mobilen Ansichten zusammen und ist dann per Touch/Klick bedienbar.

Hauptnavigation

Die Sektionen der Seite sind über eine Navigationsliste im Header der Seite
      erreichbar. Diese Navigationsliste verhält sich adaptiv und passt sich in ihrem
      Verhalten an den verfügbaren horizontalen Raum auf dem darstellenden Bildschirm
      an.

Standard Hauptnavigation

Im Ausgangzustand sind die Rubriken/Hauptsektionen der Seite über eine
      Aktionsleiste ereichbar. Diese verwendet das aus mobilen Apps bekannte Hamburger Icon.

                Rubriken

                    Toggle navigation
                    ☰

{% highlight html %}

    Rubriken

    <button type="button" class="app-navbar-toggle">
      Navigation umschalten

    </button>

{% endhighlight %}

Standard Hauptnavigation ausgeklappt

Die Navigation wird durch einen Klick aufgeklappt und zeigt die Rubriken
        in einer vertikalen Liste.

                Rubriken

                <button type="button" class="app-navbar-toggle show" data-toggle="collapse" data-target=".app-navbar-collapse">
                  Toggle navigation

                </button>

                    Startseite

                    Aktuelles

                    Landratsamt

                    Service

                    Info

                    Hier Leben

Horizontale Navigationsliste

Auf mittleren und großen Monitoren wird die Hauptnavigation als horizontale
      Navigationsleiste dargestellt und ist permanent sichtbar. Die Länge der Navigationstitel ist ungünstig. Wo möglich sollte eine Titelkürzung vorgenommen werden.

      {% include components/navbar.html %}


text:
#include "board.h"
#include "stepperMotor.h"

// -------------------------------------------------------------
// Macro Definitions

#define CCAN_BAUD_RATE 500000 					// Desired CAN Baud Rate
#define UART_BAUD_RATE 57600 					// Desired UART Baud Rate

#define BUFFER_SIZE 8

// -------------------------------------------------------------
// Static Variable Declaration

extern volatile uint32_t msTicks;

static CCAN_MSG_OBJ_T msg_obj; 					// Message Object data structure for manipulating CAN messages
static RINGBUFF_T can_rx_buffer;				// Ring Buffer for storing received CAN messages
static CCAN_MSG_OBJ_T _rx_buffer[BUFFER_SIZE]; 	// Underlying array used in ring buffer

static char str[100];							// Used for composing UART messages
static uint8_t uart_rx_buffer[BUFFER_SIZE]; 	// UART received message buffer

static bool can_error_flag;
static uint32_t can_error_info;

// -------------------------------------------------------------
// Helper Functions

/**
 * Delay the processor for a given number of milliseconds
 * @param ms Number of milliseconds to delay
 */
void _delay(uint32_t ms) {
	uint32_t curTicks = msTicks;
	while ((msTicks - curTicks) < ms);
}

// -------------------------------------------------------------
// CAN Driver Callback Functions

/*	CAN receive callback */
/*	Function is executed by the Callback handler after
    a CAN message has been received */
void CAN_rx(uint8_t msg_obj_num) {
	// LED_On();
	/* Determine which CAN message has been received */
	msg_obj.msgobj = msg_obj_num;
	/* Now load up the msg_obj structure with the CAN message */
	LPC_CCAN_API->can_receive(&msg_obj);
	if (msg_obj_num == 1) {
		RingBuffer_Insert(&can_rx_buffer, &msg_obj);
	}
}

/*	CAN transmit callback */
/*	Function is executed by the Callback handler after
    a CAN message has been transmitted */
void CAN_tx(uint8_t msg_obj_num) {
	msg_obj_num = msg_obj_num;
}

/*	CAN error callback */
/*	Function is executed by the Callback handler after
    an error has occurred on the CAN bus */
void CAN_error(uint32_t error_info) {
	can_error_info = error_info;
	can_error_flag = true;
}

// -------------------------------------------------------------
// Interrupt Service Routines

// -------------------------------------------------------------
// Main Program Loop

int main(void)
{

	//---------------
	// Initialize SysTick Timer to generate millisecond count
	if (Board_SysTick_Init()) {
		// Unrecoverable Error. Hang.
		while(1);
	}

	//---------------
	// Initialize GPIO and LED as output
	Board_LEDs_Init();
	Board_LED_On(LED0);

	//---------------
	// Initialize UART Communication
	Board_UART_Init(UART_BAUD_RATE);
	Board_UART_Println("Started up");

	//---------------
	// Initialize CAN  and CAN Ring Buffer

	RingBuffer_Init(&can_rx_buffer, _rx_buffer, sizeof(CCAN_MSG_OBJ_T), BUFFER_SIZE);
	RingBuffer_Flush(&can_rx_buffer);

	Board_CAN_Init(CCAN_BAUD_RATE, CAN_rx, CAN_tx, CAN_error);

	// For your convenience.
	// typedef struct CCAN_MSG_OBJ {
	// 	uint32_t  mode_id;
	// 	uint32_t  mask;
	// 	uint8_t   data[8];
	// 	uint8_t   dlc;
	// 	uint8_t   msgobj;
	// } CCAN_MSG_OBJ_T;

	/* [Tutorial] How do filters work?

		Incoming ID & Mask == Mode_ID for msgobj to accept message

		Incoming ID : 0xabc
		Mask: 		  0xF0F &
		            -----------
		              0xa0c

		mode_id == 0xa0c for msgobj to accept message

	*/

	msg_obj.msgobj = 1;
	msg_obj.mode_id = 0x700;
	msg_obj.mask = 0x7FC;
	LPC_CCAN_API->config_rxmsgobj(&msg_obj);

	/* [Tutorial] How do I send a CAN Message?

		There are 32 Message Objects in the CAN Peripherals Message RAM.
		We need to pick one that isn't setup for receiving messages and use it to send.

		For this exmaple we'll pick 31

		msg_obj.msgobj = 31;
		msg_obj.mode_id = 0x600; 		// CAN ID of Message to Send
		msg_obj.dlc = 8; 				// Byte length of CAN Message
		msg_obj.data[0] = 0xAA; 		// Fill your bytes here
		msg_obj.data[1] = ..;
		..
		msg_obj.data[7] = 0xBB:

		Now its time to send
		LPC_CCAN_API->can_transmit(&msg_obj);

	*/

	can_error_flag = false;
	can_error_info = 0;

	Board_UART_Print("Initializing\r\n");

	STEPPER_MOTOR_T vgauge;
	vgauge.ports[0] = 2;
	vgauge.ports[1] = 3;
	vgauge.ports[2] = 2;
	vgauge.ports[3] = 2;
	vgauge.pins[0] = 2;
	vgauge.pins[1] = 0;
	vgauge.pins[2] = 7;
	vgauge.pins[3] = 8;
	vgauge.step_per_rotation = 640;
	vgauge.step_delay = 2;
	Stepper_Init(&vgauge);
	Stepper_ZeroPosition(&vgauge, msTicks);

	Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_10, IOCON_DIGMODE_EN);
	STEPPER_MOTOR_T tgauge;
	tgauge.ports[0] = 2;
	tgauge.ports[1] = 1;
	tgauge.ports[2] = 3;
	tgauge.ports[3] = 1;
	tgauge.pins[0] = 11;
	tgauge.pins[1] = 5;
	tgauge.pins[2] = 2;
	tgauge.pins[3] = 10;
	tgauge.step_per_rotation = 640;
	tgauge.step_delay = 2;
	Stepper_Init(&tgauge);
	Stepper_ZeroPosition(&tgauge, msTicks);

	Stepper_Step(&vgauge, msTicks);
	Stepper_Step(&tgauge, msTicks);

	int vel1 = 0;
	int vel2 = 0;
	while (1) {
		if (!RingBuffer_IsEmpty(&can_rx_buffer)) {
			CCAN_MSG_OBJ_T temp_msg;
			RingBuffer_Pop(&can_rx_buffer, &temp_msg);

			if (temp_msg.mode_id==0x703){
				vel1 = (temp_msg.data_16[0]*60*22*22)/(7*12*5280);
			}
			if (temp_msg.mode_id==0x704) {
				vel2 = (temp_msg.data_16[0]*60*22*22)/(7*12*5280);
			}
			vel = (vel1+vel2)/2
			int vpospercent = vel*100/110;
			Stepper_SetPosition(&vgauge, vpospercent, msTicks);

			if (temp_msg.mode_id==0x301){
				int throt = temp_msg.data_16[0];
				int tpospercent = throt*640/6535;
				Stepper_SetPosition(&tgauge, tpospercent, msTicks);
			}

		}

		if (can_error_flag) {
			can_error_flag = false;
			Board_UART_Print("CAN Error: 0b");
			itoa(can_error_info, str, 2);
			Board_UART_Println(str);
		}

		Stepper_Step(&vgauge, msTicks);

		Stepper_Step(&tgauge, msTicks);

		}
}


text:
<?php

/**
 * Search and replace strings in the database.
 *
 * @package wp-cli
 */
class Search_Replace_Command extends WP_CLI_Command {

	private $dry_run;
	private $export_handle = false;
	private $recurse_objects;
	private $regex;
	private $skip_columns;

	/**
	 * Search/replace strings in the database.
	 *
	 * ## DESCRIPTION
	 *
	 * This command will go through all rows in a selection of tables
	 * and will replace all appearances of the old string with the new one.  The
	 * default tables are those registered on the $wpdb object (usually
	 * just WordPress core tables).
	 *
	 * It will correctly handle serialized values, and will not change primary key values.
	 *
	 * ## OPTIONS
	 *
	 * <old>
	 * : The old string.
	 *
	 * <new>
	 * : The new string.
	 *
	 * [<table>...]
	 * : List of database tables to restrict the replacement to. Wildcards are supported, e.g. wp_\*_options or wp_post\?.
	 *
	 * [--network]
	 * : Search/replace through all the tables in a multisite install.
	 *
	 * [--skip-columns=<columns>]
	 * : Do not perform the replacement in the comma-separated columns.
	 *
	 * [--dry-run]
	 * : Show report, but don't perform the changes.
	 *
	 * [--precise]
	 * : Force the use of PHP (instead of SQL) which is more thorough, but slower. Use if you see issues with serialized data.
	 *
	 * [--recurse-objects]
	 * : Enable recursing into objects to replace strings. Defaults to true; pass --no-recurse-objects to disable.
	 *
	 * [--all-tables-with-prefix]
	 * : Enable replacement on any tables that match the table prefix even if not registered on wpdb
	 *
	 * [--all-tables]
	 * : Enable replacement on ALL tables in the database, regardless of the prefix, and even if not registered on $wpdb. Overrides --network and --all-tables-with-prefix.
	 *
	 * [--verbose]
	 * : Prints rows to the console as they're updated.
	 *
	 * [--regex]
	 * : Runs the search using a regular expression. Warning: search-replace will take about 15-20x longer when using --regex.
	 *
	 * [--export[=<file>]]
	 * : Write transformed data as SQL file instead of performing in-place replacements. If <file> is not supplied, will output to STDOUT.
	 *
	 * ## EXAMPLES
	 *
	 *     wp search-replace 'http://example.dev' 'http://example.com' --skip-columns=guid
	 *
	 *     wp search-replace 'foo' 'bar' wp_posts wp_postmeta wp_terms --dry-run
	 *
	 *     # Turn your production database into a local database
	 *     wp search-replace --url=example.com example.com example.dev wp_\*_options
	 *
	 *     # Search/replace to a SQL file without transforming the database
	 *     wp search-replace foo bar --export=database.sql
	 */
	public function __invoke( $args, $assoc_args ) {
		global $wpdb;
		$old             = array_shift( $args );
		$new             = array_shift( $args );
		$total           = 0;
		$report          = array();
		$this->dry_run         = \WP_CLI\Utils\get_flag_value( $assoc_args, 'dry-run' );
		$php_only        = \WP_CLI\Utils\get_flag_value( $assoc_args, 'precise' );
		$this->recurse_objects = \WP_CLI\Utils\get_flag_value( $assoc_args, 'recurse-objects', true );
		$this->verbose         =  \WP_CLI\Utils\get_flag_value( $assoc_args, 'verbose' );
		$this->regex           =  \WP_CLI\Utils\get_flag_value( $assoc_args, 'regex' );

		$this->skip_columns = explode( ',', \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-columns' ) );

		if ( $old === $new && ! $this->regex ) {
			WP_CLI::warning( "Replacement value '{$old}' is identical to search value '{$new}'. Skipping operation." );
			exit;
		}

		if ( null !== ( $export = \WP_CLI\Utils\get_flag_value( $assoc_args, 'export' ) ) ) {
			if ( $this->dry_run ) {
				WP_CLI::error( 'You cannot supply --dry-run and --export at the same time.' );
			}
			if ( true === $export ) {
				$this->export_handle = STDOUT;
				$this->verbose = false;
			} else {
				$this->export_handle = fopen( $assoc_args['export'], 'w' );
				if ( false === $this->export_handle ) {
					WP_CLI::error( sprintf( 'Unable to open "%s" for writing.', $assoc_args['export'] ) );
				}
			}
			$php_only = true;
		}

		// never mess with hashed passwords
		$this->skip_columns[] = 'user_pass';

		// Get table names based on leftover $args or supplied $assoc_args
		$tables = \WP_CLI\Utils\wp_get_table_names( $args, $assoc_args );
		foreach ( $tables as $table ) {

			if ( $this->export_handle ) {
				fwrite( $this->export_handle, "\nDROP TABLE IF EXISTS `$table`;\n" );
				$row = $wpdb->get_row( "SHOW CREATE TABLE `$table`", ARRAY_N );
				fwrite( $this->export_handle, $row[1] . ";\n" );
				list( $table_report, $total_rows ) = $this->php_export_table( $table, $old, $new );
				$report = array_merge( $report, $table_report );
				$total += $total_rows;
				// Don't perform replacements on the actual database
				continue;
			}

			list( $primary_keys, $columns, $all_columns ) = self::get_columns( $table );

			// since we'll be updating one row at a time,
			// we need a primary key to identify the row
			if ( empty( $primary_keys ) ) {
				$report[] = array( $table, '', 'skipped' );
				continue;
			}

			foreach ( $columns as $col ) {
				if ( in_array( $col, $this->skip_columns ) ) {
					continue;
				}

				if ( $this->verbose ) {
					$this->start_time = microtime( true );
					WP_CLI::log( sprintf( 'Checking: %s.%s', $table, $col ) );
				}

				if ( ! $php_only ) {
					$serialRow = $wpdb->get_row( "SELECT * FROM `$table` WHERE `$col` REGEXP '^[aiO]:[1-9]' LIMIT 1" );
				}

				if ( $php_only || $this->regex || NULL !== $serialRow ) {
					$type = 'PHP';
					$count = $this->php_handle_col( $col, $primary_keys, $table, $old, $new );
				} else {
					$type = 'SQL';
					$count = $this->sql_handle_col( $col, $table, $old, $new );
				}

				$report[] = array( $table, $col, $count, $type );

				$total += $count;
			}
		}

		if ( $this->export_handle && STDOUT !== $this->export_handle ) {
			fclose( $this->export_handle );
		}

		// Only informational output after this point
		if ( WP_CLI::get_config( 'quiet' ) || STDOUT === $this->export_handle ) {
			return;
		}

		$table = new \cli\Table();
		$table->setHeaders( array( 'Table', 'Column', 'Replacements', 'Type' ) );
		$table->setRows( $report );
		$table->display();

		if ( ! $this->dry_run ) {
			if ( ! empty( $assoc_args['export'] ) ) {
				$success_message = "Made {$total} replacements and exported to {$assoc_args['export']}.";
			} else {
				$success_message = "Made $total replacements.";
				if ( $total && 'Default' !== WP_CLI\Utils\wp_get_cache_type() ) {
					$success_message .= ' Please remember to flush your persistent object cache with `wp cache flush`.';
				}
			}
			WP_CLI::success( $success_message );
		}
	}

	private function php_export_table( $table, $old, $new ) {
		list( $primary_keys, $columns, $all_columns ) = self::get_columns( $table );
		$chunk_size = getenv( 'BEHAT_RUN' ) ? 10 : 1000;
		$args = array(
			'table'      => $table,
			'fields'     => $all_columns,
			'chunk_size' => $chunk_size
		);

		$replacer = new \WP_CLI\SearchReplacer( $old, $new, $this->recurse_objects, $this->regex );
		$col_counts = array_fill_keys( $all_columns, 0 );
		if ( $this->verbose ) {
			$this->start_time = microtime( true );
			WP_CLI::log( sprintf( 'Checking: %s', $table ) );
		}
		foreach ( new \WP_CLI\Iterators\Table( $args ) as $i => $row ) {
			$row_fields = array();
			foreach( $all_columns as $col ) {
				$value = $row->$col;
				if ( $value && ! in_array( $col, $primary_keys ) && ! in_array( $col, $this->skip_columns ) ) {
					$new_value = $replacer->run( $value );
					if ( $new_value !== $value ) {
						$col_counts[ $col ]++;
						$value = $new_value;
					}
				}
				$row_fields[ $col ] = $value;
			}
			$this->write_sql_row_fields( $table, $row_fields );
		}

		$table_report = array();
		$total_rows = $total_cols = 0;
		foreach ( $col_counts as $col => $col_count ) {
			$table_report[] = array( $table, $col, $col_count, 'PHP' );
			if ( $col_count ) {
				$total_cols++;
				$total_rows += $col_count;
			}
		}

		if ( $this->verbose ) {
			$time = round( microtime( true ) - $this->start_time, 3 );
			WP_CLI::log( sprintf( '%d columns and %d total rows affected using PHP (in %ss)', $total_cols, $total_rows, $time ) );
		}

		return array( $table_report, $total_rows );
	}

	private function sql_handle_col( $col, $table, $old, $new ) {
		global $wpdb;

		if ( $this->dry_run ) {
			$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(`$col`) FROM `$table` WHERE `$col` LIKE %s;", '%' . self::esc_like( $old ) . '%' ) );
		} else {
			$count = $wpdb->query( $wpdb->prepare( "UPDATE `$table` SET `$col` = REPLACE(`$col`, %s, %s);", $old, $new ) );
		}

		if ( $this->verbose ) {
			$time = round( microtime( true ) - $this->start_time, 3 );
			WP_CLI::log( sprintf( '%d rows affected using SQL (in %ss)', $count, $time ) );
		}
		return $count;
	}

	private function php_handle_col( $col, $primary_keys, $table, $old, $new ) {
		global $wpdb;

		// We don't want to have to generate thousands of rows when running the test suite
		$chunk_size = getenv( 'BEHAT_RUN' ) ? 10 : 1000;

		$fields = $primary_keys;
		$fields[] = $col;

		$args = array(
			'table' => $table,
			'fields' => $fields,
			'where' => $this->regex ? '' : "`$col`" . $wpdb->prepare( ' LIKE %s', '%' . self::esc_like( $old ) . '%' ),
			'chunk_size' => $chunk_size
		);

		$it = new \WP_CLI\Iterators\Table( $args );

		$count = 0;

		$replacer = new \WP_CLI\SearchReplacer( $old, $new, $this->recurse_objects, $this->regex );

		foreach ( $it as $row ) {
			if ( '' === $row->$col )
				continue;

			$value = $replacer->run( $row->$col );

			if ( $value === $row->$col ) {
				continue;
			}

			if ( $this->dry_run ) {
				if ( $value != $row->$col )
					$count++;
			} else {
				$where = array();
				foreach ( $primary_keys as $primary_key ) {
					$where[ $primary_key ] = $row->$primary_key;
				}

				$count += $wpdb->update( $table, array( $col => $value ), $where );
			}
		}

		if ( $this->verbose ) {
			$time = round( microtime( true ) - $this->start_time, 3 );
			WP_CLI::log( sprintf( '%d rows affected using PHP (in %ss)', $count, $time ) );
		}

		return $count;
	}

	private function write_sql_row_fields( $table, $row_fields ) {
		global $wpdb;
		$sql = "INSERT INTO `$table` (";
		$sql .= join( ', ', array_map(
		function ( $field ) {
			return "`$field`";
		},
		array_keys( $row_fields )
		) );
		$sql .= ') VALUES (';
		$sql .= join( ', ', array_fill( 0, count( $row_fields ), '%s' ) );
		$sql .= ");\n";
		$sql = $wpdb->prepare( $sql, array_values( $row_fields ) );
		fwrite( $this->export_handle, $sql );
	}

	private static function get_columns( $table ) {
		global $wpdb;

		$primary_keys = $text_columns = $all_columns = array();
		foreach ( $wpdb->get_results( "DESCRIBE $table" ) as $col ) {
			if ( 'PRI' === $col->Key ) {
				$primary_keys[] = $col->Field;
			}
			if ( self::is_text_col( $col->Type ) ) {
				$text_columns[] = $col->Field;
			}
			$all_columns[] = $col->Field;
		}
		return array( $primary_keys, $text_columns, $all_columns );
	}

	private static function is_text_col( $type ) {
		foreach ( array( 'text', 'varchar' ) as $token ) {
			if ( false !== strpos( $type, $token ) )
				return true;
		}

		return false;
	}

	private static function esc_like( $old ) {
		global $wpdb;

		// Remove notices in 4.0 and support backwards compatibility
		if( method_exists( $wpdb, 'esc_like' ) ) {
			// 4.0
			$old = $wpdb->esc_like( $old );
		} else {
			// 3.9 or less
			$old = like_escape( esc_sql( $old ) );
		}

		return $old;
	}

}

WP_CLI::add_command( 'search-replace', 'Search_Replace_Command' );


text:
<?php

namespace WindowsAzure\Common\Models;

use WindowsAzure\Common\Internal\Resources;

/**
 * Holds OAuth access token data.
 *
 * @category  Microsoft
 *
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 *
 * @version   Release: 0.5.0_2016-11
 *
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 */
class OAuthAccessToken
{
    /**
     * Access token itself.
     *
     * @var string
     */
    private $_accessToken;

    /**
     * Unix time the access token valid before.
     *
     * @var int
     */
    private $_expiresIn;

    /**
     * Scope of access token.
     *
     * @var string
     */
    private $_scope;

    /**
     * Creates object from $parsedResponse.
     *
     * @param array $parsedResponse JSON response parsed into array
     *
     * @return OAuthAccessToken
     */
    public static function create(array $parsedResponse)
    {
        $result = new self();

        $result->setAccessToken($parsedResponse[Resources::OAUTH_ACCESS_TOKEN]);
        $result->setExpiresIn($parsedResponse[Resources::OAUTH_EXPIRES_IN] + time());
        $result->setScope($parsedResponse[Resources::OAUTH_SCOPE]);

        return $result;
    }

    /**
     * Gets access token.
     *
     * @return string
     */
    public function getAccessToken()
    {
        return $this->_accessToken;
    }

    /**
     * Sets access token.
     *
     * @param string $accessToken OAuth access token
     */
    public function setAccessToken($accessToken)
    {
        $this->_accessToken = $accessToken;
    }

    /**
     * Gets expired date of access token in unixdate.
     *
     * @return int
     */
    public function getExpiresIn()
    {
        return $this->_expiresIn;
    }

    /**
     * Sets access token expires date.
     *
     * @param int $expiresIn OAuth access token expire date
     */
    public function setExpiresIn($expiresIn)
    {
        $this->_expiresIn = $expiresIn;
    }

    /**
     * Gets access token scope.
     *
     * @return string
     */
    public function getScope()
    {
        return $this->_scope;
    }

    /**
     * Sets access token scope.
     *
     * @param string $scope OAuth access token scope
     */
    public function setScope($scope)
    {
        $this->_scope = $scope;
    }
}


text:
package org.openntf.domino.design;

/**
 * @author Roland Praml
 *
 */
public interface CompositeWiring extends DesignBaseNamed {

}


text:
package io.aeron;

import io.aeron.logbuffer.*;
import io.aeron.logbuffer.ControlledFragmentHandler.Action;
import org.agrona.*;
import org.agrona.concurrent.UnsafeBuffer;
import org.agrona.concurrent.status.Position;

import java.nio.channels.FileChannel;

import static io.aeron.logbuffer.ControlledFragmentHandler.Action.*;
import static io.aeron.logbuffer.FrameDescriptor.*;
import static io.aeron.logbuffer.LogBufferDescriptor.endOfStreamPosition;
import static io.aeron.logbuffer.LogBufferDescriptor.indexByPosition;
import static io.aeron.protocol.DataHeaderFlyweight.HEADER_LENGTH;
import static io.aeron.protocol.DataHeaderFlyweight.TERM_ID_FIELD_OFFSET;
import static java.nio.ByteOrder.LITTLE_ENDIAN;

/**
 * Represents a replicated {@link Publication} from a which matches a {@link Subscription}.
 * Each {@link Image} identifies a source {@link Publication} by {@link #sessionId()}.
 *

 * By default fragmented messages are not reassembled before delivery. If an application must
 * receive whole messages, whether or not they were fragmented, then the Subscriber
 * should be created with a {@link FragmentAssembler} or a custom implementation.
 *

 * It is an application's responsibility to {@link #poll} the {@link Image} for new messages.
 *

 * Note:Images are not threadsafe and should not be shared between subscribers.
 */
public class Image
{
    private final long correlationId;
    private final long joinPosition;
    private long finalPosition;
    private final int sessionId;
    private final int initialTermId;
    private final int termLengthMask;
    private final int positionBitsToShift;
    private boolean isEos;
    private volatile boolean isClosed;

    private final Position subscriberPosition;
    private final UnsafeBuffer[] termBuffers;
    private final Header header;
    private final ErrorHandler errorHandler;
    private final LogBuffers logBuffers;
    private final String sourceIdentity;
    private final Subscription subscription;

    /**
     * Construct a new image over a log to represent a stream of messages from a {@link Publication}.
     *
     * @param subscription       to which this {@link Image} belongs.
     * @param sessionId          of the stream of messages.
     * @param subscriberPosition for indicating the position of the subscriber in the stream.
     * @param logBuffers         containing the stream of messages.
     * @param errorHandler       to be called if an error occurs when polling for messages.
     * @param sourceIdentity     of the source sending the stream of messages.
     * @param correlationId      of the request to the media driver.
     */
    public Image(
        final Subscription subscription,
        final int sessionId,
        final Position subscriberPosition,
        final LogBuffers logBuffers,
        final ErrorHandler errorHandler,
        final String sourceIdentity,
        final long correlationId)
    {
        this.subscription = subscription;
        this.sessionId = sessionId;
        this.subscriberPosition = subscriberPosition;
        this.logBuffers = logBuffers;
        this.errorHandler = errorHandler;
        this.sourceIdentity = sourceIdentity;
        this.correlationId = correlationId;
        this.joinPosition = subscriberPosition.get();

        termBuffers = logBuffers.duplicateTermBuffers();

        final int termLength = logBuffers.termLength();
        this.termLengthMask = termLength - 1;
        this.positionBitsToShift = LogBufferDescriptor.positionBitsToShift(termLength);
        this.initialTermId = LogBufferDescriptor.initialTermId(logBuffers.metaDataBuffer());
        header = new Header(initialTermId, positionBitsToShift, this);
    }

    /**
     * Number of bits to right shift a position to get a term count for how far the stream has progressed.
     *
     * @return of bits to right shift a position to get a term count for how far the stream has progressed.
     */
    public int positionBitsToShift()
    {
        return positionBitsToShift;
    }

    /**
     * Get the length in bytes for each term partition in the log buffer.
     *
     * @return the length in bytes for each term partition in the log buffer.
     */
    public int termBufferLength()
    {
        return termLengthMask + 1;
    }

    /**
     * The sessionId for the steam of messages. Sessions are unique within a {@link Subscription} and unique across
     * all {@link Publication}s from a {@link #sourceIdentity()}.
     *
     * @return the sessionId for the steam of messages.
     */
    public int sessionId()
    {
        return sessionId;
    }

    /**
     * The source identity of the sending publisher as an abstract concept appropriate for the media.
     *
     * @return source identity of the sending publisher as an abstract concept appropriate for the media.
     */
    public String sourceIdentity()
    {
        return sourceIdentity;
    }

    /**
     * The length in bytes of the MTU (Maximum Transmission Unit) the Sender used for the datagram.
     *
     * @return length in bytes of the MTU (Maximum Transmission Unit) the Sender used for the datagram.
     */
    public int mtuLength()
    {
        return LogBufferDescriptor.mtuLength(logBuffers.metaDataBuffer());
    }

    /**
     * The initial term at which the stream started for this session.
     *
     * @return the initial term id.
     */
    public int initialTermId()
    {
        return initialTermId;
    }

    /**
     * The correlationId for identification of the image with the media driver.
     *
     * @return the correlationId for identification of the image with the media driver.
     */
    public long correlationId()
    {
        return correlationId;
    }

    /**
     * Get the {@link Subscription} to which this {@link Image} belongs.
     *
     * @return the {@link Subscription} to which this {@link Image} belongs.
     */
    public Subscription subscription()
    {
        return subscription;
    }

    /**
     * Has this object been closed and should no longer be used?
     *
     * @return true if it has been closed otherwise false.
     */
    public boolean isClosed()
    {
        return isClosed;
    }

    /**
     * Get the position the subscriber joined this stream at.
     *
     * @return the position the subscriber joined this stream at.
     */
    public long joinPosition()
    {
        return joinPosition;
    }

    /**
     * The position this {@link Image} has been consumed to by the subscriber.
     *
     * @return the position this {@link Image} has been consumed to by the subscriber.
     */
    public long position()
    {
        if (isClosed)
        {
            return finalPosition;
        }

        return subscriberPosition.get();
    }

    /**
     * Set the subscriber position for this {@link Image} to indicate where it has been consumed to.
     *
     * @param newPosition for the consumption point.
     */
    public void position(final long newPosition)
    {
        if (!isClosed)
        {
            validatePosition(newPosition);
            subscriberPosition.setOrdered(newPosition);
        }
    }

    /**
     * The counter id for the subscriber position counter.
     *
     * @return the id for the subscriber position counter.
     */
    public int subscriberPositionId()
    {
        return subscriberPosition.id();
    }

    /**
     * Is the current consumed position at the end of the stream?
     *
     * @return true if at the end of the stream or false if not.
     */
    public boolean isEndOfStream()
    {
        if (isClosed)
        {
            return isEos;
        }

        return subscriberPosition.get() >= endOfStreamPosition(logBuffers.metaDataBuffer());
    }

    /**
     * Count of observed active transports within the image liveness timeout.
     *
     * If the image is closed, then this is 0. This may also be 0 if no actual datagrams have arrived. IPC
     * Images also will be 0.
     *
     * @return count of active transports - 0 if Image is closed, no datagrams yet, or IPC.
     */
    public int activeTransportCount()
    {
        if (isClosed)
        {
            return 0;
        }

        return LogBufferDescriptor.activeTransportCount(logBuffers.metaDataBuffer());
    }

    /**
     * The {@link FileChannel} to the raw log of the Image.
     *
     * @return the {@link FileChannel} to the raw log of the Image.
     */
    public FileChannel fileChannel()
    {
        return logBuffers.fileChannel();
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link FragmentHandler} up to a limited number of fragments as specified.
     *

     * Use a {@link FragmentAssembler} to assemble messages which span multiple fragments.
     *
     * @param fragmentHandler to which message fragments are delivered.
     * @param fragmentLimit   for the number of fragments to be consumed during one polling operation.
     * @return the number of fragments that have been consumed.
     * @see FragmentAssembler
     * @see ImageFragmentAssembler
     */
    public int poll(final FragmentHandler fragmentHandler, final int fragmentLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        final long position = subscriberPosition.get();

        return TermReader.read(
            activeTermBuffer(position),
            (int)position & termLengthMask,
            fragmentHandler,
            fragmentLimit,
            header,
            errorHandler,
            position,
            subscriberPosition);
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link ControlledFragmentHandler} up to a limited number of fragments as specified.
     *

     * Use a {@link ControlledFragmentAssembler} to assemble messages which span multiple fragments.
     *
     * @param handler       to which message fragments are delivered.
     * @param fragmentLimit for the number of fragments to be consumed during one polling operation.
     * @return the number of fragments that have been consumed.
     * @see ControlledFragmentAssembler
     * @see ImageControlledFragmentAssembler
     */
    public int controlledPoll(final ControlledFragmentHandler handler, final int fragmentLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        int fragmentsRead = 0;
        long initialPosition = subscriberPosition.get();
        int initialOffset = (int)initialPosition & termLengthMask;
        int offset = initialOffset;
        final UnsafeBuffer termBuffer = activeTermBuffer(initialPosition);
        final int capacity = termBuffer.capacity();
        final Header header = this.header;
        header.buffer(termBuffer);

        try
        {
            while (fragmentsRead < fragmentLimit && offset < capacity)
            {
                final int length = frameLengthVolatile(termBuffer, offset);
                if (length <= 0)
                {
                    break;
                }

                final int frameOffset = offset;
                final int alignedLength = BitUtil.align(length, FRAME_ALIGNMENT);
                offset += alignedLength;

                if (isPaddingFrame(termBuffer, frameOffset))
                {
                    continue;
                }

                ++fragmentsRead;
                header.offset(frameOffset);

                final Action action = handler.onFragment(
                    termBuffer, frameOffset + HEADER_LENGTH, length - HEADER_LENGTH, header);

                if (ABORT == action)
                {
                    --fragmentsRead;
                    offset -= alignedLength;
                    break;
                }

                if (BREAK == action)
                {
                    break;
                }
                if (COMMIT == action)
                {
                    initialPosition += (offset - initialOffset);
                    initialOffset = offset;
                    subscriberPosition.setOrdered(initialPosition);
                }
            }
        }
        catch (final Throwable t)
        {
            errorHandler.onError(t);
        }
        finally
        {
            final long resultingPosition = initialPosition + (offset - initialOffset);
            if (resultingPosition > initialPosition)
            {
                subscriberPosition.setOrdered(resultingPosition);
            }
        }

        return fragmentsRead;
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link FragmentHandler} up to a limited number of fragments as specified or
     * the maximum position specified.
     *

     * Use a {@link FragmentAssembler} to assemble messages which span multiple fragments.
     *
     * @param handler       to which message fragments are delivered.
     * @param limitPosition to consume messages up to.
     * @param fragmentLimit for the number of fragments to be consumed during one polling operation.
     * @return the number of fragments that have been consumed.
     * @see FragmentAssembler
     * @see ImageFragmentAssembler
     */
    public int boundedPoll(final FragmentHandler handler, final long limitPosition, final int fragmentLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        int fragmentsRead = 0;
        final long initialPosition = subscriberPosition.get();
        final int initialOffset = (int)initialPosition & termLengthMask;
        int offset = initialOffset;
        final UnsafeBuffer termBuffer = activeTermBuffer(initialPosition);
        final int limitOffset = (int)Math.min(termBuffer.capacity(), (limitPosition - initialPosition) + offset);
        final Header header = this.header;
        header.buffer(termBuffer);

        try
        {
            while (fragmentsRead < fragmentLimit && offset < limitOffset)
            {
                final int length = frameLengthVolatile(termBuffer, offset);
                if (length <= 0)
                {
                    break;
                }

                final int frameOffset = offset;
                final int alignedLength = BitUtil.align(length, FRAME_ALIGNMENT);
                offset += alignedLength;

                if (isPaddingFrame(termBuffer, frameOffset))
                {
                    continue;
                }

                ++fragmentsRead;
                header.offset(frameOffset);
                handler.onFragment(termBuffer, frameOffset + HEADER_LENGTH, length - HEADER_LENGTH, header);
            }
        }
        catch (final Throwable t)
        {
            errorHandler.onError(t);
        }
        finally
        {
            final long resultingPosition = initialPosition + (offset - initialOffset);
            if (resultingPosition > initialPosition)
            {
                subscriberPosition.setOrdered(resultingPosition);
            }
        }

        return fragmentsRead;
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link ControlledFragmentHandler} up to a limited number of fragments as specified or
     * the maximum position specified.
     *

     * Use a {@link ControlledFragmentAssembler} to assemble messages which span multiple fragments.
     *
     * @param handler       to which message fragments are delivered.
     * @param limitPosition to consume messages up to.
     * @param fragmentLimit for the number of fragments to be consumed during one polling operation.
     * @return the number of fragments that have been consumed.
     * @see ControlledFragmentAssembler
     * @see ImageControlledFragmentAssembler
     */
    public int boundedControlledPoll(
        final ControlledFragmentHandler handler, final long limitPosition, final int fragmentLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        int fragmentsRead = 0;
        long initialPosition = subscriberPosition.get();
        int initialOffset = (int)initialPosition & termLengthMask;
        int offset = initialOffset;
        final UnsafeBuffer termBuffer = activeTermBuffer(initialPosition);
        final int limitOffset = (int)Math.min(termBuffer.capacity(), (limitPosition - initialPosition) + offset);
        final Header header = this.header;
        header.buffer(termBuffer);

        try
        {
            while (fragmentsRead < fragmentLimit && offset < limitOffset)
            {
                final int length = frameLengthVolatile(termBuffer, offset);
                if (length <= 0)
                {
                    break;
                }

                final int frameOffset = offset;
                final int alignedLength = BitUtil.align(length, FRAME_ALIGNMENT);
                offset += alignedLength;

                if (isPaddingFrame(termBuffer, frameOffset))
                {
                    continue;
                }

                ++fragmentsRead;
                header.offset(frameOffset);

                final Action action = handler.onFragment(
                    termBuffer, frameOffset + HEADER_LENGTH, length - HEADER_LENGTH, header);

                if (ABORT == action)
                {
                    --fragmentsRead;
                    offset -= alignedLength;
                    break;
                }

                if (BREAK == action)
                {
                    break;
                }
                if (COMMIT == action)
                {
                    initialPosition += (offset - initialOffset);
                    initialOffset = offset;
                    subscriberPosition.setOrdered(initialPosition);
                }
            }
        }
        catch (final Throwable t)
        {
            errorHandler.onError(t);
        }
        finally
        {
            final long resultingPosition = initialPosition + (offset - initialOffset);
            if (resultingPosition > initialPosition)
            {
                subscriberPosition.setOrdered(resultingPosition);
            }
        }

        return fragmentsRead;
    }

    /**
     * Peek for new messages in a stream by scanning forward from an initial position. If new messages are found then
     * they will be delivered to the {@link ControlledFragmentHandler} up to a limited position.
     *

     * Use a {@link ControlledFragmentAssembler} to assemble messages which span multiple fragments. Scans must also
     * start at the beginning of a message so that the assembler is reset.
     *
     * @param initialPosition from which to peek forward.
     * @param handler         to which message fragments are delivered.
     * @param limitPosition   up to which can be scanned.
     * @return the resulting position after the scan terminates which is a complete message.
     * @see ControlledFragmentAssembler
     * @see ImageControlledFragmentAssembler
     */
    public long controlledPeek(
        final long initialPosition, final ControlledFragmentHandler handler, final long limitPosition)
    {
        if (isClosed)
        {
            return initialPosition;
        }

        validatePosition(initialPosition);
        if (initialPosition >= limitPosition)
        {
            return initialPosition;
        }

        int initialOffset = (int)initialPosition & termLengthMask;
        int offset = initialOffset;
        long position = initialPosition;
        final UnsafeBuffer termBuffer = activeTermBuffer(initialPosition);
        final Header header = this.header;
        final int limitOffset = (int)Math.min(termBuffer.capacity(), (limitPosition - initialPosition) + offset);
        header.buffer(termBuffer);
        long resultingPosition = initialPosition;

        try
        {
            while (offset < limitOffset)
            {
                final int length = frameLengthVolatile(termBuffer, offset);
                if (length <= 0)
                {
                    break;
                }

                final int frameOffset = offset;
                offset += BitUtil.align(length, FRAME_ALIGNMENT);

                if (isPaddingFrame(termBuffer, frameOffset))
                {
                    position += (offset - initialOffset);
                    initialOffset = offset;
                    resultingPosition = position;

                    continue;
                }

                header.offset(frameOffset);

                final Action action = handler.onFragment(
                    termBuffer, frameOffset + HEADER_LENGTH, length - HEADER_LENGTH, header);

                if (ABORT == action)
                {
                    break;
                }

                position += (offset - initialOffset);
                initialOffset = offset;

                if ((header.flags() & END_FRAG_FLAG) == END_FRAG_FLAG)
                {
                    resultingPosition = position;
                }

                if (BREAK == action)
                {
                    break;
                }
            }
        }
        catch (final Throwable t)
        {
            errorHandler.onError(t);
        }

        return resultingPosition;
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link BlockHandler} up to a limited number of bytes.
     *

     * A scan will terminate if a padding frame is encountered. If first frame in a scan is padding then a block
     * for the padding is notified. If the padding comes after the first frame in a scan then the scan terminates
     * at the offset the padding frame begins. Padding frames are delivered singularly in a block.
     *

     * Padding frames may be for a greater range than the limit offset but only the header needs to be valid so
     * relevant length of the frame is {@link io.aeron.protocol.DataHeaderFlyweight#HEADER_LENGTH}.
     *
     * @param handler          to which block is delivered.
     * @param blockLengthLimit up to which a block may be in length.
     * @return the number of bytes that have been consumed.
     */
    public int blockPoll(final BlockHandler handler, final int blockLengthLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        final long position = subscriberPosition.get();
        final int offset = (int)position & termLengthMask;
        final int limitOffset = Math.min(offset + blockLengthLimit, termLengthMask + 1);
        final UnsafeBuffer termBuffer = activeTermBuffer(position);
        final int resultingOffset = TermBlockScanner.scan(termBuffer, offset, limitOffset);
        final int length = resultingOffset - offset;

        if (resultingOffset > offset)
        {
            try
            {
                final int termId = termBuffer.getInt(offset + TERM_ID_FIELD_OFFSET, LITTLE_ENDIAN);
                handler.onBlock(termBuffer, offset, length, sessionId, termId);
            }
            catch (final Throwable t)
            {
                errorHandler.onError(t);
            }
            finally
            {
                subscriberPosition.setOrdered(position + length);
            }
        }

        return length;
    }

    /**
     * Poll for new messages in a stream. If new messages are found beyond the last consumed position then they
     * will be delivered to the {@link RawBlockHandler} up to a limited number of bytes.
     *

     * This method is useful for operations like bulk archiving a stream to file.
     *

     * A scan will terminate if a padding frame is encountered. If first frame in a scan is padding then a block
     * for the padding is notified. If the padding comes after the first frame in a scan then the scan terminates
     * at the offset the padding frame begins. Padding frames are delivered singularly in a block.
     *

     * Padding frames may be for a greater range than the limit offset but only the header needs to be valid so
     * relevant length of the frame is {@link io.aeron.protocol.DataHeaderFlyweight#HEADER_LENGTH}.
     *
     * @param handler          to which block is delivered.
     * @param blockLengthLimit up to which a block may be in length.
     * @return the number of bytes that have been consumed.
     */
    public int rawPoll(final RawBlockHandler handler, final int blockLengthLimit)
    {
        if (isClosed)
        {
            return 0;
        }

        final long position = subscriberPosition.get();
        final int offset = (int)position & termLengthMask;
        final int activeIndex = indexByPosition(position, positionBitsToShift);
        final UnsafeBuffer termBuffer = termBuffers[activeIndex];
        final int capacity = termBuffer.capacity();
        final int limitOffset = Math.min(offset + blockLengthLimit, capacity);
        final int resultingOffset = TermBlockScanner.scan(termBuffer, offset, limitOffset);
        final int length = resultingOffset - offset;

        if (resultingOffset > offset)
        {
            try
            {
                final long fileOffset = ((long)capacity * activeIndex) + offset;
                final int termId = termBuffer.getInt(offset + TERM_ID_FIELD_OFFSET, LITTLE_ENDIAN);

                handler.onBlock(logBuffers.fileChannel(), fileOffset, termBuffer, offset, length, sessionId, termId);
            }
            catch (final Throwable t)
            {
                errorHandler.onError(t);
            }
            finally
            {
                subscriberPosition.setOrdered(position + length);
            }
        }

        return length;
    }

    private UnsafeBuffer activeTermBuffer(final long position)
    {
        return termBuffers[indexByPosition(position, positionBitsToShift)];
    }

    private void validatePosition(final long position)
    {
        final long currentPosition = subscriberPosition.get();
        final long limitPosition = (currentPosition - (currentPosition & termLengthMask)) + termLengthMask + 1;
        if (position < currentPosition || position > limitPosition)
        {
            throw new IllegalArgumentException(
                position + " position out of range: " + currentPosition + "-" + limitPosition);
        }

        if (0 != (position & (FRAME_ALIGNMENT - 1)))
        {
            throw new IllegalArgumentException(position + " position not aligned to FRAME_ALIGNMENT");
        }
    }

    LogBuffers logBuffers()
    {
        return logBuffers;
    }

    void close()
    {
        finalPosition = subscriberPosition.getVolatile();
        isEos = finalPosition >= endOfStreamPosition(logBuffers.metaDataBuffer());
        isClosed = true;
    }

    public String toString()
    {
        return "Image{" +
            "correlationId=" + correlationId +
            ", sessionId=" + sessionId +
            ", isClosed=" + isClosed +
            ", isEos=" + isEndOfStream() +
            ", initialTermId=" + initialTermId +
            ", termLength=" + termBufferLength() +
            ", joinPosition=" + joinPosition +
            ", position=" + position() +
            ", sourceIdentity='" + sourceIdentity + '\'' +
            ", subscription=" + subscription +
            '}';
    }
}


text:
@extends('dashboard')

@section('title', 'Alta Capturista')

@section('content')

Alta capturista

          <form class="form-horizontal" action="{{ action('CapturistaController@attemptAltaCapturista') }}" method="post">

                Nombre:

                  <input type="text" class="form-control" id="nombre" placeholder="Nombre" name="nombre">

                Email:

                  <input type="email" class="form-control" id="email" value="{{ $email or '' }}" placeholder="Email" name="email">

                Password provisional:

                  <input type="password" class="form-control" id="password" placeholder="Password" name="password">

                Rol

                  <select class="form-control" id="rol" name="rol">
                    <option value="0"></option>
                    @foreach($roles as $rol)
                      <option value="{{ $rol->id }}">{{ $rol->nombre }}</option>
                    @endforeach
                  </select>

              <input type="hidden" name="_token" value="{{ csrf_token() }}">

                  <button type="submit" class="btn btn-default">Registrar</button>

          </form>

          @if(isset($error))

                Error: {{ $error }}

          @endif

          @if(isset($successMessage))

                Operación exitosa {{ $successMessage }}

          @endif

@stop


text:
<?php

	// Basic paths
Todoyu::$CONFIG['EXT']['assets']['basePath']	= PATH_FILES . DIR_SEP . 'assets';
Todoyu::$CONFIG['EXT']['assets']['cachePath']	= PATH_CACHE . DIR_SEP . 'temp';
Todoyu::$CONFIG['EXT']['assets']['previewPath']	= PATH_CACHE . DIR_SEP . 'previews';

// Delete files on hard disk when deleted in database
Todoyu::$CONFIG['EXT']['assets']['deleteFiles']	= false;

	// Add allowed paths where files can be downloaded from
Todoyu::$CONFIG['sendFile']['allow'][]	= Todoyu::$CONFIG['EXT']['assets']['basePath'];
Todoyu::$CONFIG['sendFile']['allow'][]	= Todoyu::$CONFIG['EXT']['assets']['cachePath'];

	// Set max upload file size
Todoyu::$CONFIG['EXT']['assets']['max_file_size']	= 50000000; // 50MB
Todoyu::$CONFIG['EXT']['assets']['max_length_filename']	= 256;

/* --------------------------------------------
	Add asset content tab and context menu
   -------------------------------------------- */
if( Todoyu::allowed('assets', 'general:use') ) {
		// Add assets tab into task
	TodoyuContentItemTabManager::registerTab('project', 'task', 'assets', 'TodoyuAssetsTaskAssetViewHelper::getTabLabel', 'TodoyuAssetsTaskAssetViewHelper::getTabContent', 30);
		// Add "Add New > Asset" to task context menu
	TodoyuContextMenuManager::addFunction('Task', 'TodoyuAssetsAssetManager::getTaskContextMenuItems', 150);
}

	// Asset selector
TodoyuFormRecordsManager::addType('asset', 'TodoyuAssetsFormElement_RecordsAsset', 'TodoyuAssetsAssetManager::getMatchingAssets');

	// Task asset selector
TodoyuFormRecordsManager::addType('taskAsset', 'TodoyuAssetsFormElement_RecordsTaskAsset', 'TodoyuAssetsAssetManager::getMatchingAssets');

	// Project asset selector
TodoyuFormRecordsManager::addType('projectAsset', 'TodoyuAssetsFormElement_RecordsProjectAsset', 'TodoyuAssetsAssetManager::getMatchingAssets');

	// General asset selector
TodoyuFormManager::addFieldType('recordsSelectAsset', 'TodoyuAssetsFormElement_RecordSelectAsset', 'ext/assets/view/form/FormElement_SelectAsset.tmpl');

/* ---------------------------------------------
	Add quickInfo callback for assets
   --------------------------------------------- */
TodoyuQuickinfoManager::addFunction('asset', 'TodoyuAssetsAssetQuickinfoManager::addAssetInfos');

?>


text:
`usage: oref0-reset-usb`

oref0-reset-usb - Drop USB stack, rebind the usb kernel modules.


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="course.examples.maplocationfromcontacts"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.READ_CONTACTS" >
    </uses-permission>

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher" >
        <activity
            android:name="MapLocationFromContactsActivity"
            android:label="MapLocationFromContacts" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
package com.hazelcast.internal.diagnostics;

import com.hazelcast.test.HazelcastTestSupport;
import org.junit.Before;

import java.io.CharArrayWriter;
import java.io.PrintWriter;

public class AbstractDiagnosticsPluginTest extends HazelcastTestSupport {

    protected DiagnosticsLogWriterImpl logWriter;
    private CharArrayWriter out;

    @Before
    public final void setupLogWriter() {
        logWriter = new DiagnosticsLogWriterImpl();
        out = new CharArrayWriter();
        logWriter.init(new PrintWriter(out));
    }

    protected void reset() {
        out.reset();
    }

    protected String getContent() {
        return out.toString();
    }

    protected void assertContains(String expected) {
        assertContains(getContent(), expected);
    }

    protected void assertNotContains(String expected) {
        assertNotContains(getContent(), expected);
    }
}


text:
package com.pkware.truth.android.widget;

import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.google.common.truth.FailureMetadata;
import com.pkware.truth.android.view.AbstractViewSubject;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static android.os.Build.VERSION_CODES.JELLY_BEAN;

/**
 * Propositions for {@link ImageView} subjects.
 */
public class ImageViewSubject extends AbstractViewSubject<ImageView> {

  @Nullable
  private final ImageView actual;

  public ImageViewSubject(@Nonnull FailureMetadata failureMetadata, @Nullable ImageView actual) {
    super(failureMetadata, actual);
    this.actual = actual;
  }

  public void isAligningBaselineToBottom() {
    check("getBaselineAlignBottom()").that(actual.getBaselineAlignBottom()).isTrue();
  }

  public void isNotAligningBaselineToBottom() {
    check("getBaselineAlignBottom()").that(actual.getBaselineAlignBottom()).isFalse();
  }

  @TargetApi(JELLY_BEAN)
  public void isCroppingToPadding() {
    check("getCropToPadding()").that(actual.getCropToPadding()).isTrue();
  }

  @TargetApi(JELLY_BEAN)
  public void isNotCroppingToPadding() {
    check("getCropToPadding()").that(actual.getCropToPadding()).isFalse();
  }

  public void hasDrawable(@Nullable Drawable drawable) {
    check("getDrawable()").that(actual.getDrawable()).isSameInstanceAs(drawable);
  }

  @TargetApi(JELLY_BEAN)
  public void hasImageAlpha(int alpha) {
    check("getImageAlpha()").that(actual.getImageAlpha()).isEqualTo(alpha);
  }

  public void hasScaleType(@Nullable ImageView.ScaleType type) {
    check("getScaleType()").that(actual.getScaleType()).isEqualTo(type);
  }
}


text:
var args = arguments[0] || {};

$.row.articleUrl = args.articleUrl;

$.date.text = args.date;
$.title.text = args.title;


text:
nintendo_codepuzzle
===================


text:
using System;
using System.Linq;
using Csla;
using Csla.Serialization;

#if!SILVERLIGHT
using Rolodex.Business.Data;
using RolodexEF;
using Csla.Data;
#endif

namespace Rolodex.Business.BusinessClasses
{
    [Serializable]
    public class DuplicateCompanyCommand : CommandBase<DuplicateCompanyCommand>
    {
#if SILVERLIGHT
        public DuplicateCompanyCommand(){}
#else
        protected DuplicateCompanyCommand() { }
#endif
        private static PropertyInfo<int> CompanyIDProperty = RegisterProperty(typeof(DuplicateCompanyCommand), new PropertyInfo<int>("CompanyID"));
        public int CompanyID
        {
            get { return ReadProperty(CompanyIDProperty); }
        }

        private static PropertyInfo<string> CompanyNameProperty = RegisterProperty(typeof(DuplicateCompanyCommand), new PropertyInfo<string>("CompanyName"));
        public string CompanyName
        {
            get { return ReadProperty(CompanyNameProperty); }
        }

        private static PropertyInfo<bool> IsDuplicateProperty = RegisterProperty(typeof(DuplicateCompanyCommand), new PropertyInfo<bool>("IsDuplicate"));
        public bool IsDuplicate
        {
            get { return ReadProperty(IsDuplicateProperty); }
        }

        public DuplicateCompanyCommand(string companyName, int companyId)
        {
            LoadProperty(CompanyIDProperty, companyId);
            LoadProperty(CompanyNameProperty, companyName);
        }

#if !SILVERLIGHT

        protected override void DataPortal_Execute()
        {

            using (ObjectContextManager<RolodexEntities> manager = ObjectContextManager<RolodexEF.RolodexEntities>.GetManager(DataConnection.EFConnectionName, true))
            {
                int companyId = ReadProperty(CompanyIDProperty);
                string companyName = ReadProperty(CompanyNameProperty);
                Companies company = (from oneCompany in manager.ObjectContext.Companies
                                     where
                                      oneCompany.CompanyId != companyId &&
                                      oneCompany.CompanyName == companyName
                                     select oneCompany).FirstOrDefault();
                if (company != null)
                    LoadProperty(IsDuplicateProperty, true);
                else
                    LoadProperty(IsDuplicateProperty, false);
            }

        }
#endif
    }
}


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

namespace XenAdmin.Core
{
    [DebuggerDisplay("XenServerPatch (Name={Name}; Uuid={Uuid})")]
    public class XenServerPatch : IEquatable<XenServerPatch>
    {
        private string _uuid;
        public readonly string Name;
        public readonly string Description;
        public readonly string Guidance;
        public readonly bool GuidanceMandatory;
        public readonly Version Version;
        public readonly string Url;
        public readonly string PatchUrl;
        public readonly DateTime TimeStamp;
        public readonly int Priority;
        public readonly long InstallationSize; // installation size, in btyes
        public readonly long DownloadSize; // download size, in btyes
        public readonly bool ContainsLivepatch;

        public readonly List<string> ConflictingPatches;
        public readonly List<string> RequiredPatches;

        private const int DEFAULT_PRIORITY = 2;

        public XenServerPatch(string uuid, string name, string description, string guidance, string guidance_mandatory , string version, string url,
            string patchUrl, string timestamp, string priority, string installationSize, string downloadSize, string containsLivepatch = "false")
        {
            _uuid = uuid;
            Name = name;
            Description = description;
            Guidance = guidance;
            GuidanceMandatory = !string.IsNullOrEmpty(guidance_mandatory) && guidance_mandatory.ToLowerInvariant().Contains("true");
            Version = new Version(version);
            Url = url;
            PatchUrl = patchUrl;
            DateTime.TryParse(timestamp, out TimeStamp);
            if (!Int32.TryParse(priority, out Priority))
                Priority = DEFAULT_PRIORITY;
            if (!Int64.TryParse(installationSize, out InstallationSize))
                InstallationSize = 0;
            if (!Int64.TryParse(downloadSize, out DownloadSize))
                DownloadSize = 0;
            ContainsLivepatch = !string.IsNullOrEmpty(containsLivepatch) && containsLivepatch.ToLowerInvariant().Contains("true");
        }

        public XenServerPatch(string uuid, string name, string description, string guidance, string guidance_mandatory, string version, string url,
            string patchUrl, string timestamp, string priority, string installationSize, string downloadSize, string containsLivepatch, List<string> conflictingPatches, List<string> requiredPatches)
            : this(uuid, name, description, guidance, guidance_mandatory, version, url, patchUrl, timestamp, priority, installationSize, downloadSize, containsLivepatch)
        {

            ConflictingPatches = conflictingPatches;
            RequiredPatches = requiredPatches;
        }

        public string Uuid
        {
            get { return _uuid; }
        }

        public bool Equals(XenServerPatch other)
        {
            if (other == null)
                return false;

            return string.Equals(Uuid, other.Uuid, StringComparison.OrdinalIgnoreCase);
        }

        public after_apply_guidance after_apply_guidance
        {
            get
            {
                switch (Guidance)
                {
                    case "restartHVM":
                        return after_apply_guidance.restartHVM;

                    case "restartPV":
                        return after_apply_guidance.restartPV;

                    case "restartHost":
                        return after_apply_guidance.restartHost;

                    case "restartXAPI":
                        return after_apply_guidance.restartXAPI;

                    default:
                        return after_apply_guidance.unknown;
                }
            }
        }
    }
}


text:
require File.join(File.dirname(__FILE__), "..", "..", "..", "..", "spec_helper")

describe "_form.html.erb" do
  include GoUtil, FormUI
  before(:each) do
    @material = PackageMaterialConfig.new
    @cruise_config = CruiseConfig.new
    repository1 = PackageRepositoryMother.create("repo1", "repo1-name", "pluginid", "version", Configuration.new([ConfigurationPropertyMother.create("k1", false, "v1")].to_java(ConfigurationProperty)))
    repository2 = PackageRepositoryMother.create("repo2", "repo2-name", "pluginid", "version", Configuration.new([ConfigurationPropertyMother.create("k1", false, "v1")].to_java(ConfigurationProperty)))
    pkg1 = PackageDefinitionMother.create("pkg1", "package1-name", Configuration.new([ConfigurationPropertyMother.create("k2", false, "v2")].to_java(ConfigurationProperty)), repository1)
    @pkg2 = PackageDefinitionMother.create("pkg2", "package2-name", Configuration.new([ConfigurationPropertyMother.create("k2", false, "v2")].to_java(ConfigurationProperty)), repository1)
    repository1.setPackages(Packages.new([pkg1, @pkg2].to_java(PackageDefinition)))
    repos = PackageRepositories.new
    repos.add(repository1)
    repos.add(repository2)
    @cruise_config.setPackageRepositories(repos)
    assign(:cruise_config, @cruise_config)
    assign(:original_cruise_config, @cruise_config)
    set(@cruise_config, "md5", "abc")
  end

  it "should render all material attributes" do
    in_params(:pipeline_name => "pipeline-name")
    render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

    expect(response.body).to have_selector("input[type='hidden'][name='current_tab'][value='materials']")
    expect(response.body).to have_selector("input[type='radio'][name='material[create_or_associate_pkg_def]'][value='associate'][checked='checked']")
    expect(response.body).to have_selector("input[type='radio'][name='material[create_or_associate_pkg_def]'][value='create']")
    expect(response.body).to have_selector(".popup_form input[type='hidden'][name='material_type'][value='#{@material.getType()}']")
    Capybara.string(response.body).find("select[name='material[package_definition[repositoryId]]']").tap do |select|
      expect(select).not_to have_selector("option")
    end
    Capybara.string(response.body).find("select[name='material[#{PackageMaterialConfig::PACKAGE_ID}]']").tap do |select|
      expect(select).not_to have_selector("option")
    end
    expect(response.body).to have_selector(".form_buttons button[type='submit'] span", :text => "SAVE")
  end

  it "should pre-select repo and package for the material" do
    @material.setPackageDefinition(@pkg2)
    in_params(:pipeline_name => "pipeline-name", :finger_print => "foo")

    render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

    expect(response.body).to have_selector("input[type='hidden'][name='current_tab'][value='materials']")
    expect(response.body).to have_selector(".popup_form input[type='hidden'][name='material_type'][value='#{@material.getType()}']")
    expect(response.body).to have_selector("input[type='radio'][name='material[create_or_associate_pkg_def]'][value='create']")
    expect(response.body).to have_selector("input[type='radio'][name='material[create_or_associate_pkg_def]'][value='associate'][checked='checked']")
    Capybara.string(response.body).find("select[name='material[package_definition[repositoryId]]']").tap do |select|
      expect(select).not_to have_selector("option")
    end
    Capybara.string(response.body).find("select[name='material[#{PackageMaterialConfig::PACKAGE_ID}]']").tap do |select|
      expect(select).not_to have_selector("option")
    end
    expect(response.body).to have_selector(".form_buttons button[type='submit'] span", :text => "SAVE")
  end

  describe "render package definition" do
    before(:each) do
      @material.setPackageDefinition(@pkg2)
      @metadata = PackageConfigurations.new
      @metadata.addConfiguration(PackageConfiguration.new("key1").with(PackageConfiguration::SECURE, false).with(PackageConfiguration::DISPLAY_NAME, "Key 1"))
      @metadata.addConfiguration(PackageConfiguration.new("key2").with(PackageConfiguration::SECURE, false).with(PackageConfiguration::DISPLAY_NAME, "Key 2"))
      @metadata.addConfiguration(PackageConfiguration.new("key3_secure").with(PackageConfiguration::SECURE, true).with(PackageConfiguration::DISPLAY_NAME, "Key 3 Secure"))

      p1 = ConfigurationProperty.new(ConfigurationKey.new("key1"), ConfigurationValue.new("value1"), nil, nil)
      p2 = ConfigurationProperty.new(ConfigurationKey.new("key2"), ConfigurationValue.new("value2"), nil, nil)
      p3_secure = ConfigurationProperty.new(ConfigurationKey.new("key3_secure"), nil, EncryptedConfigurationValue.new("secure"), nil)
      @package = PackageDefinition.new("go", "package-name", Configuration.new([p1, p2, p3_secure].to_java(ConfigurationProperty)))
      @package_view_model_new = PackageViewModel.new(@metadata, @package)
      assign(:package_configuration, @package_view_model_new)
    end

    it "should render show_package_definition with check connection if the form was opened for associating a existing package definition" do
      in_params(:pipeline_name => "pipeline-name", :finger_print => "foo", :material => {:create_or_associate_pkg_def => "associate"})

      stub_template "admin/package_definitions/show_package_definition" => "show package definition"

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      assert_template partial: "admin/package_definitions/show_package_definition", :locals => {:scope => {:package_configuration => @package_view_model_new}}
    end

    it "should render new package definition with check connection if the form was opened to create a new package definition" do
      in_params(:pipeline_name => "pipeline-name", :finger_print => "foo", :material => {:create_or_associate_pkg_def => "create"})

      stub_template "admin/package_definitions/form" => "package definitions form"

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      assert_template partial: "admin/package_definitions/form", :locals => {:scope => {:package_configuration => @package_view_model_new}}
    end

    it "should render check connection when a form is opened for creating a new package definition" do
      in_params(:pipeline_name => "pipeline-name", :finger_print => "foo", :material => {:create_or_associate_pkg_def => "create"})

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      Capybara.string(response.body).find(".new_form_content").tap do |new_form_content|
        new_form_content.find(".field.no-label-element") do |no_label_element|
          expect(no_label_element).to have_selector("button.submit#check_package span", :text => "CHECK PACKAGE")
          expect(no_label_element).to have_selector("span#package_check_message")
        end
      end
    end

    it "should render check connection when a form is opened for associating an existing package definition" do
      in_params(:pipeline_name => "pipeline-name", :finger_print => "foo", :material => {:create_or_associate_pkg_def => "associate"})

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      Capybara.string(response.body).find(".new_form_content").tap do |new_form_content|
        new_form_content.find(".field.no-label-element") do |no_label_element|
          expect(no_label_element).to have_selector("button.submit#check_package span", :text => "CHECK PACKAGE")
          expect(no_label_element).to have_selector("span#package_check_message")
        end
      end
    end

    it "should render warning if no repositories exist" do
      @cruise_config.setPackageRepositories(PackageRepositories.new)

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      Capybara.string(response.body).find(".new_form_content").tap do |new_form_content|
          expect(new_form_content).to have_selector("p.warnings", :text => "No repositories found. Please add a package repository first.")
          new_form_content.find("p.warnings") do |warnings|
            expect(warnings).to have_selector("a[href='#{package_repositories_new_path}']", :text => "add a package repository")
          end
      end
    end

    it "should not render package configuration elements if there is no package configured" do
      assign(:package_configuration, nil)
      in_params(:pipeline_name => "pipeline-name", :finger_print => "foo", :material => {:create_or_associate_pkg_def => "associate"})

      render :partial => "admin/materials/package/form.html", :locals => {:scope => {:material => @material, :url => "url", :submit_label => "save"}}

      expect(response.body).not_to have_selector("#check_package span")
      expect(response.body).not_to have_selector("span#package_check_message")
    end
  end
end


text:
package com.bignerdranch.android.photoballery;

import java.io.IOException;
import java.lang.annotation.Target;
import java.util.ArrayList;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.SearchView;

public class PhotoGalleryFragment extends VisibleFragment {
	private static final String TAG = "PhotoGalleryFragment";

	GridView mGridView;
	ArrayList<GalleryItem> mItems;
	ThumbnailDownloader<ImageView> mThumbnailThread;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRetainInstance(true);
		setHasOptionsMenu(true);

		updateItems();

//		Intent i = new Intent(getActivity(), PollService.class);
//		getActivity().startService(i);
		PollService.setServiceAlarm(getActivity(), true);

		mThumbnailThread = new ThumbnailDownloader<ImageView>(new Handler());
		mThumbnailThread.setListener(new ThumbnailDownloader.Listener<ImageView>() {

			@Override
			public void onThumbnailDownload(ImageView imageView, Bitmap thumbmail) {
				if (isVisible()) {
				    imageView.setImageBitmap(thumbmail);
				}
			}

		});
		mThumbnailThread.start();
		mThumbnailThread.getLooper();
		Log.i(TAG, "Background thread started");
	}

	public void updateItems() {
		new FetchItemsTask().execute();
	}

	@Override
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_photo_gallery, container, false);
		mGridView = (GridView) v.findViewById(R.id.gridView);

		setupAdapter();

		mGridView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> gridView, View view, int pos,
					long id) {
				GalleryItem item = mItems.get(pos);

				Uri photoPageUri = Uri.parse(item.getUrl());
//				Intent i = new Intent(Intent.ACTION_VIEW, photoPageUri);
				Intent i = new Intent(getActivity(), PhotoPageActivity.class);
				i.setData(photoPageUri);
				startActivity(i);
			}
		});
		return v;
	}

	@Override
	@TargetApi(11)
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		super.onCreateOptionsMenu(menu, inflater);
		inflater.inflate(R.menu.fragment__photo_gallery, menu);
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			// Pull out the SearchView
			MenuItem searchItem = menu.findItem(R.id.menu_item_search);
			SearchView searchview = (SearchView) searchItem.getActionView();

			//Get the data from our searchable.xml as a SearchableInfo
			SearchManager searchManager = (SearchManager)getActivity().getSystemService(Context.SEARCH_SERVICE);
			ComponentName name = getActivity().getComponentName();
			SearchableInfo searchableInfo = searchManager.getSearchableInfo(name);

			searchview.setSearchableInfo(searchableInfo);
		}

	}

	@Override
	@TargetApi(11)
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_item_search:
			getActivity().onSearchRequested();
			return true;
		case R.id.menu_item_toggle_polling:
			boolean shouldStartAlarm = !PollService.isServiceAlarmOn(getActivity());
			PollService.setServiceAlarm(getActivity(), shouldStartAlarm);

			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
				getActivity().invalidateOptionsMenu();
			}
			return true;
		case R.id.menu_item_clear:
			PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putString(FlickrFetchr.PREF_SEARCH_QUERY, null).commit();
			updateItems();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

	@Override
	public void onPrepareOptionsMenu(Menu menu) {
		super.onPrepareOptionsMenu(menu);

		MenuItem toggleItem = menu.findItem(R.id.menu_item_toggle_polling);
		if (PollService.isServiceAlarmOn(getActivity())) {
			toggleItem.setTitle(R.string.stop_polling);
		} else {
			toggleItem.setTitle(R.string.start_polling);
		}
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		mThumbnailThread.quit();
		Log.i(TAG, "Background thread destoryed");
	}
	@Override
	public void onDestroyView() {
		super.onDestroyView();
		mThumbnailThread.clearQueue();
	}
	void setupAdapter() {
		if (getActivity() == null || mGridView == null) return;

		if (mItems != null) {
//			mGridView.setAdapter(new ArrayAdapter<GalleryItem>(getActivity(), android.R.layout.simple_gallery_item, mItems));
			mGridView.setAdapter(new GalleryItemAdapter(mItems));
		} else {
			mGridView.setAdapter(null);
		}

	}

	private class FetchItemsTask extends AsyncTask<Void, Void, ArrayList<GalleryItem>> {
		@Override
		protected ArrayList<GalleryItem> doInBackground(Void... params) {

//			try {
//				String result = new FlickrFetchr().getUrl("http://www.google.com");
//				Log.i(TAG, "Fetched contents of URL: " + result);
//			} catch (IOException e) {
//				Log.e(TAG, "Failed to fetch URL: ", e);
//			}
//			new FlickrFetchr().fetchItems();
//			return null;
//			String query = "android"; //Just for testing
			Activity activity = getActivity();
			if (activity == null)
				return new ArrayList<GalleryItem>();

			String query = PreferenceManager.getDefaultSharedPreferences(activity).getString(FlickrFetchr.PREF_SEARCH_QUERY, null);
			if (query != null) {
				return new FlickrFetchr().search(query);
			} else {
				return new FlickrFetchr().fetchItems();
			}
		}

		@Override
		protected void onPostExecute(ArrayList<GalleryItem> result) {
			mItems = result;
			setupAdapter();
		}
	}

	private class GalleryItemAdapter extends ArrayAdapter<GalleryItem> {

		public GalleryItemAdapter(ArrayList<GalleryItem> items) {
			super(getActivity(), 0, items);
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			if (convertView == null) {
				convertView = getActivity().getLayoutInflater().inflate(R.layout.gallery_item, parent, false);
			}
			ImageView imageView = (ImageView) convertView.findViewById(R.id.gallery_item_imageView);
			imageView.setImageResource(R.drawable.brian_up_close);
			GalleryItem item = getItem(position);
			mThumbnailThread.queueThumbnail(imageView, item.getUrl());

			return convertView;
		}

	}
}


text:
import re
from crispy_forms.helper import FormHelper
from crispy_forms import layout as crispy
from django import forms
from django.core.exceptions import ValidationError

from corehq.apps.users.models import CommCareUser

class EmailForm(forms.Form):
    email_subject = forms.CharField(max_length=100)
    email_body = forms.CharField()
    real_email = forms.BooleanField(required=False)

class BrokenBuildsForm(forms.Form):
    builds = forms.CharField(
        widget=forms.Textarea(attrs={'rows': '30', 'cols': '50'})
    )

    def clean_builds(self):
        self.build_ids = re.findall(r'[\w-]+', self.cleaned_data['builds'])
        if not self.build_ids:
            raise ValidationError("You must provide a ")
        return self.cleaned_data['builds']

class AuthenticateAsForm(forms.Form):
    username = forms.CharField(max_length=255)
    domain = forms.CharField(label=u"Domain (used for mobile workers)", max_length=255, required=False)

    def clean(self):
        username = self.cleaned_data['username']
        domain = self.cleaned_data['domain']

        # Ensure that the username exists either as the raw input or with fully qualified name
        if domain:
            extended_username = u"{}@{}.commcarehq.org".format(username, domain)
            user = CommCareUser.get_by_username(username=extended_username)
            self.cleaned_data['username'] = extended_username
            if user is None:
                raise forms.ValidationError(
                    u"Cannot find user '{}' for domain '{}'".format(username, domain)
                )
        else:
            user = CommCareUser.get_by_username(username=username)
            if user is None:
                raise forms.ValidationError(u"Cannot find user '{}'".format(username))

        if not user.is_commcare_user():
            raise forms.ValidationError(u"User '{}' is not a CommCareUser".format(username))

        return self.cleaned_data

    def __init__(self, *args, **kwargs):
        super(AuthenticateAsForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_id = 'auth-as-form'
        self.helper.layout = crispy.Layout(
            'username',
            'domain',
            crispy.Submit(
                'authenticate_as',
                'Authenticate As'
            )
        )


text:
/********************* 有任何问题欢迎反馈给我 liuweiself@126.com ****************************************/
/***************  https://github.com/waynezxcv/Gallop 持续更新 ***************************/
/******************** 正在不断完善中,谢谢~  Enjoy ******************************************************/

#import "ArticleListViewController.h"
#import "ArticleListTableViewCell.h"
#import "HTMLParsingViewController.h"
#import "LWActiveIncator.h"

@interface ArticleListViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView* tableView;
@property (nonatomic,strong) NSMutableArray* dataSource;
@property (nonatomic,assign) BOOL isNeedRefresh;

@end

@implementation ArticleListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"ariticle list";
    self.isNeedRefresh = YES;
    self.dataSource = [[NSMutableArray alloc] init];
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];

    NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"articlelist" ofType:@"plist"];
    NSArray* list = [[NSArray alloc] initWithContentsOfFile:plistPath];

    for (NSDictionary* dict in list) {
        @autoreleasepool {
            ArticleListModel* model = [[ArticleListModel alloc] init];
            model.idString = dict[@"id"];
            model.images = dict[@"images"];
            model.title = dict[@"title"];
            [self.dataSource addObject:model];
        }
    }
    [self.tableView reloadData];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataSource.count;
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString* cellIdentifier = @"cellID";
    ArticleListTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[ArticleListTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier];
    }
    ArticleListModel* model = [self.dataSource objectAtIndex:indexPath.row];
    cell.model = model;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    ArticleListModel* model = [self.dataSource objectAtIndex:indexPath.row];
    NSURL* URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://daily.zhihu.com/story/%@",model.idString]];
    HTMLParsingViewController* vc = [[HTMLParsingViewController alloc] init];
    vc.URL = URL;
    NSLog(@"%@",URL);
    [self.navigationController pushViewController:vc animated:YES];
}

@end


text:
<tabset>
  <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled" ng-click="onClick(tab)">

  </tab>
</tabset>


text:
var test        = require('tape')
  , concat      = require('concat-stream')
  , fs          = require('fs')
  , helpMe      = require('./')

test('show the doc/help.txt from the require.main folder if no options are passed', function(t) {
  t.plan(2)

  helpMe()
    .createHelpStream()
    .pipe(concat(function(data) {
      fs.readFile('./doc/help.txt', function(err, expected) {
        t.error(err)
        t.equal(data.toString(), expected.toString())
      })
    }))
})

test('show a generic help.txt from a folder to a stream', function(t) {
  t.plan(2)

  helpMe({
      dir: 'fixture/basic'
  }).createHelpStream()
    .pipe(concat(function(data) {
      fs.readFile('fixture/basic/help.txt', function(err, expected) {
        t.error(err)
        t.equal(data.toString(), expected.toString())
      })
    }))
})

test('custom help command with an array', function(t) {
  t.plan(2)

  helpMe({
      dir: 'fixture/basic'
  }).createHelpStream(['hello'])
    .pipe(concat(function(data) {
      fs.readFile('fixture/basic/hello.txt', function(err, expected) {
        t.error(err)
        t.equal(data.toString(), expected.toString())
      })
    }))
})

test('custom help command without an ext', function(t) {
  t.plan(2)

  helpMe({
      dir: 'fixture/basic'
    , ext: ''
  }).createHelpStream(['hello'])
    .pipe(concat(function(data) {
      fs.readFile('fixture/basic/hello', function(err, expected) {
        t.error(err)
        t.equal(data.toString(), expected.toString())
      })
    }))
})

test('custom help command with a string', function(t) {
  t.plan(2)

  helpMe({
      dir: 'fixture/basic'
  }).createHelpStream('hello')
    .pipe(concat(function(data) {
      fs.readFile('fixture/basic/hello.txt', function(err, expected) {
        t.error(err)
        t.equal(data.toString(), expected.toString())
      })
    }))
})

test('missing help file', function(t) {
  t.plan(1)

  helpMe({
      dir: 'fixture/basic'
  }).createHelpStream('abcde')
    .on('error', function(err) {
      t.equal(err.code, 'ENOENT')
    })
    .resume()
})