text:
<?php

namespace Bitbucket\API\Authentication;

use Buzz\Message\RequestInterface;

/**
 * Build authorization header from previously signed OAuth parameters
 * and pass it to current request.
 *
 * @author  Alexandru G.    <alex@gentle.ro>
 */
class OAuth implements AuthenticationInterface
{
    /**
     * @var string
     */
    protected $authHeader;

    /**
     * @param string|array $params OAuth signed parameters
     */
    public function __construct($params)
    {
        $this->setAuthHeader($params);
    }

    /**
     * Get authorization header parameters
     *
     * @access public
     * @return string
     */
    public function getAuthHeader()
    {
        return $this->authHeader;
    }

    /**
     * Set authorization header parameters
     *
     * @access public
     * @param  string|array $params OAuth signed parameters
     * @return void
     */
    public function setAuthHeader($params)
    {
        if (is_array($params)) {
            $this->authHeader = $this->toHeader($params);
        } else {
            if (strpos($params, 'Authorization: ') !== false) {
                $params = str_replace('Authorization: ', '', $params);
            }

            $this->authHeader = $params;
        }
    }

    /**
     * Build authorization header from array
     *
     * @access public
     * @param  array  $params
     * @return string
     */
    protected function toHeader(array $params)
    {
        $out    = '';
        $last   = end($params);

        foreach ($params as $k => $v) {
            $out .= $k.'="'.$v.'"';

            if ($v != $last) {
                $out .= ',';
            }
        }

        return $out;
    }

    /**
     * {@inheritdoc}
     */
    public function authenticate(RequestInterface $request)
    {
        if (strpos($this->authHeader, 'OAuth') === false) {
            $this->authHeader = 'OAuth '.$this->authHeader;
        }

        $request->addHeader('Authorization: '.$this->authHeader);

        return $request;
    }
}

redpajama_set_name: RedPajamaGithub


text:
todos

    <form id="todo-form" ng-submit="addTodo()">
      <input id="new-todo" placeholder="What needs to be done?" ng-model="newTodo" autofocus>
    </form>

    <input id="toggle-all" type="checkbox" ng-model="allChecked" ng-click="markAll(allChecked)">
    Mark all as complete

          <input class="toggle" type="checkbox" ng-model="todo.completed">
          {{todo.title}}
          <button class="destroy" ng-click="removeTodo(todo)"></button>

    {{remainingCount}}
      <ng-pluralize count="remainingCount" when="{ one: 'item left', other: 'items left' }"></ng-pluralize>

        All

        Active

        Completed

    <button id="clear-completed" ng-click="clearCompletedTodos()" ng-show="completedCount">Clear completed ({{completedCount}})</button>


text:
package com.nhl.link.rest.runtime.cayenne;

import org.apache.cayenne.exp.Property;

import com.nhl.link.rest.ObjectMapper;
import com.nhl.link.rest.ObjectMapperFactory;
import com.nhl.link.rest.runtime.processor.update.UpdateContext;

/**
 * An {@link ObjectMapperFactory} that locates objects by the combination of FK
 * to parent and some other column. I.e. those objects in 1..N relationships
 * that have a unique property within parent.
 *
 * @since 1.4
 */
public class ByKeyObjectMapperFactory implements ObjectMapperFactory {

	private String property;

	public static ByKeyObjectMapperFactory byKey(String key) {
		return new ByKeyObjectMapperFactory(key);
	}

	public static ByKeyObjectMapperFactory byKey(Property<?> key) {
		return new ByKeyObjectMapperFactory(key.getName());
	}

	private ByKeyObjectMapperFactory(String property) {
		this.property = property;
	}

	@Override
	public <T> ObjectMapper<T> createMapper(UpdateContext<T> context) {
		return new ByKeyObjectMapper<>(property);
	}
}


text:
package com.intellij.ide.util.scopeChooser;

import com.intellij.ide.IdeBundle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.NamedConfigurable;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.packageDependencies.DependencyValidationManager;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
import com.intellij.psi.search.scope.packageSet.PackageSet;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;

public class ScopeConfigurable extends NamedConfigurable<NamedScope> {
  private final Disposable myDisposable = Disposer.newDisposable();
  private NamedScope myScope;
  private ScopeEditorPanel myPanel;
  private String myPackageSet;
  private final JCheckBox mySharedCheckbox;
  private boolean myShareScope = false;
  private final Project myProject;
  private Icon myIcon;

  public ScopeConfigurable(final NamedScope scope, final boolean shareScope, final Project project, final Runnable updateTree) {
    super(true, updateTree);
    myScope = scope;
    myShareScope = shareScope;
    myProject = project;
    mySharedCheckbox = new JCheckBox(IdeBundle.message("share.scope.checkbox.title"), shareScope);
    myPanel = new ScopeEditorPanel(project, getHolder());
    myIcon = getHolder(myShareScope).getIcon();
    mySharedCheckbox.addActionListener(e -> {
      myIcon = getHolder().getIcon();
      myPanel.setHolder(getHolder());
    });
  }

  @Override
  public void setDisplayName(final String name) {
    if (Comparing.strEqual(myScope.getName(), name)){
      return;
    }
    final PackageSet packageSet = myScope.getValue();
    myScope = new NamedScope(name, myIcon, packageSet != null ? packageSet.createCopy() : null);
  }

  @Override
  public NamedScope getEditableObject() {
    return new NamedScope(myScope.getName(), myIcon, myPanel.getCurrentScope());
  }

  @Override
  public String getBannerSlogan() {
    return IdeBundle.message("scope.banner.text", myScope.getName());
  }

  @Override
  public String getDisplayName() {
    return myScope.getName();
  }

  @NotNull
  public NamedScopesHolder getHolder() {
    return getHolder(mySharedCheckbox.isSelected());
  }

  @NotNull
  private NamedScopesHolder getHolder(boolean local) {
    return (local
            ? DependencyValidationManager.getInstance(myProject)
            : NamedScopeManager.getInstance(myProject));
  }

  @Override
  @Nullable
  @NonNls
  public String getHelpTopic() {
    return "project.scopes";
  }

  @Override
  public JComponent createOptionsPanel() {
    final JPanel wholePanel = new JPanel(new BorderLayout());
    wholePanel.add(myPanel.getPanel(), BorderLayout.CENTER);
    wholePanel.add(mySharedCheckbox, BorderLayout.SOUTH);
    wholePanel.setBorder(JBUI.Borders.empty(0, 10, 10, 10));
    return wholePanel;
  }

  @Override
  public boolean isModified() {
    if (mySharedCheckbox.isSelected() != myShareScope) return true;
    final PackageSet currentScope = myPanel.getCurrentScope();
    return !Comparing.strEqual(myPackageSet, currentScope != null ? currentScope.getText() : null);
  }

  @Override
  public void apply() throws ConfigurationException {
    try {
      myPanel.apply();
      final PackageSet packageSet = myPanel.getCurrentScope();
      myScope = new NamedScope(myScope.getName(), myIcon, packageSet);
      myPackageSet = packageSet != null ? packageSet.getText() : null;
      myShareScope = mySharedCheckbox.isSelected();
    }
    catch (ConfigurationException e) {
      //was canceled - didn't change anything
    }
  }

  @Override
  public void reset() {
    mySharedCheckbox.setSelected(myShareScope);
    myPanel.reset(myScope.getValue(), null);
    final PackageSet packageSet = myScope.getValue();
    myPackageSet = packageSet != null ? packageSet.getText() : null;
  }

  @Override
  public void disposeUIResources() {
    if (myPanel != null){
      myPanel.cancelCurrentProgress();
      myPanel.clearCaches();
      Disposer.dispose(myDisposable);
      myPanel = null;
    }
  }

  public void cancelCurrentProgress(){
    if (myPanel != null) { //not disposed
      myPanel.cancelCurrentProgress();
    }
  }

  public NamedScope getScope() {
    return myScope;
  }

  public void restoreCanceledProgress() {
    if (myPanel != null) {
      myPanel.restoreCanceledProgress();
    }
  }

  @Nullable
  @Override
  public Icon getIcon(boolean expanded) {
    return myIcon;
  }
}


text:
pymatgen.electronic\_structure.plotter module
=============================================

.. automodule:: pymatgen.electronic_structure.plotter
   :members:
   :undoc-members:
   :show-inheritance:


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AH.Shared.MODEL;
namespace AH.ATMS.MODEL
{
    public class Brand
    {
        public string BrandID { set; get; }
        public string BrandName { set; get; }
        public string FormName { set; get; }
        public int intMode { get; set; }
        public string groupid { set; get; }
        public EntryParameter EntryParameter { set; get; }
    }
}


text:
INSERT INTO button (id, name, recipe, btn_special, tourn_legal, set_id) VALUES
(10002, 'RandomBMFixed', '', 1, 0, (SELECT id FROM buttonset WHERE name="RandomBM")),
(10003, 'RandomBMMixed', '', 1, 0, (SELECT id FROM buttonset WHERE name="RandomBM"));

UPDATE button
SET flavor_text='This button gets a different random recipe in each game, with a fixed random formula (5 dice, no swing dice, two of them having a single skill chosen independently from c, f, and d)'
WHERE name='RandomBMFixed';

UPDATE button
SET flavor_text='This button gets a different random recipe in each game, with a fixed random formula (5 dice, no swing dice, three skills chosen from all existing skills, with each skill dealt out twice randomly and independently over all dice)'
WHERE name='RandomBMMixed';


text:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="skeleton-archetype"
    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <fileSets>
    <fileSet encoding="UTF-8">
      <directory></directory>
      <includes>
        <include>README.md</include>
      </includes>
    </fileSet>
  </fileSets>
</archetype-descriptor>


text:
/*************************************************************************
 *
 * Hxj.Data
 *
 * 2010-2-10
 *
 * steven hu
 *
 * Support: http://www.cnblogs.com/huxj
 *
 *
 * Change History:
 *
 *
**************************************************************************/

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using Dos;
using Dos.ORM;

namespace Dos.ORM
{
    /// <summary>
    /// BatchCommander is used to execute batch queries.
    /// </summary>
    public sealed class BatchCommander
    {
        #region Private Members

        private Database db;
        private int batchSize;
        private DbTransaction tran;
        private List<DbCommand> batchCommands;
        private bool isUsingOutsideTransaction = false;

        private DbCommand MergeCommands()
        {
            DbCommand cmd = db.GetSqlStringCommand("init");
            StringBuilder sb = new StringBuilder();
            foreach (DbCommand item in batchCommands)
            {
                if (item.CommandType == CommandType.Text)
                {
                    foreach (DbParameter dbPara in item.Parameters)
                    {
                        DbParameter p = (DbParameter)((ICloneable)dbPara).Clone();
                        cmd.Parameters.Add(p);
                    }
                    sb.Append(item.CommandText);
                    sb.Append(";");
                }
            }

            if (sb.Length > 0)
            {
                if (db.DbProvider is Dos.ORM.Oracle.OracleProvider)
                {
                    sb.Insert(0, "begin ");
                    sb.Append(" end;");
                }
            }

            cmd.CommandText = sb.ToString();
            return cmd;
        }

        #endregion

        #region Public Members

        /// <summary>
        /// Ö´ÐÐ
        /// </summary>
        public void ExecuteBatch()
        {
            DbCommand cmd = MergeCommands();

            if (cmd.CommandText.Trim().Length > 0)
            {
                if (tran != null)
                {
                    cmd.Connection = tran.Connection;
                    cmd.Transaction = tran;

                }
                else
                {
                    cmd.Connection = db.GetConnection();
                }

                db.DbProvider.PrepareCommand(cmd);

                db.WriteLog(cmd);

                cmd.ExecuteNonQuery();
            }

            batchCommands.Clear();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BatchCommander"/> class.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="batchSize">Size of the batch.</param>
        /// <param name="il">The il.</param>
        public BatchCommander(Database db, int batchSize, IsolationLevel il)
            : this(db, batchSize, db.BeginTransaction(il))
        {
            isUsingOutsideTransaction = false;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BatchCommander"/> class.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="batchSize">Size of the batch.</param>
        /// <param name="tran">The tran.</param>
        public BatchCommander(Database db, int batchSize, DbTransaction tran)
        {
            Check.Require(db != null, "db could not be null.");
            Check.Require(batchSize > 0, "Arguments error - batchSize should > 0.");

            this.db = db;
            this.batchSize = batchSize;
            batchCommands = new List<DbCommand>(batchSize);
            this.tran = tran;
            if (tran != null)
            {
                isUsingOutsideTransaction = true;
            }

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BatchCommander"/> class.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="batchSize">Size of the batch.</param>
        public BatchCommander(Database db, int batchSize)
            : this(db, batchSize, db.BeginTransaction())
        {
            isUsingOutsideTransaction = false;
        }

        /// <summary>
        /// Processes the specified CMD.
        /// </summary>
        /// <param name="cmd">The CMD.</param>
        public void Process(DbCommand cmd)
        {
            if (cmd == null)
            {
                return;
            }

            cmd.Transaction = null;
            cmd.Connection = null;

            batchCommands.Add(cmd);

            if (!db.DbProvider.SupportBatch || batchCommands.Count >= batchSize)
            {
                try
                {
                    ExecuteBatch();
                }
                catch
                {
                    if (tran != null && (!isUsingOutsideTransaction))
                    {
                        tran.Rollback();
                    }

                    throw;
                }
            }
        }

        /// <summary>
        /// Closes this instance.
        /// </summary>
        public void Close()
        {
            try
            {
                ExecuteBatch();

                if (tran != null && (!isUsingOutsideTransaction))
                {
                    tran.Commit();
                }
            }
            catch
            {
                if (tran != null && (!isUsingOutsideTransaction))
                {
                    tran.Rollback();
                }

                throw;
            }
            finally
            {
                if (tran != null && (!isUsingOutsideTransaction))
                {
                    db.CloseConnection(tran);
                }
            }
        }

        #endregion
    }
}


text:
import DocumentTitle from 'react-document-title';
import NewTodo from './newtodo';
import React from 'react';
import TodoList from './todolist';
import {FormattedMessage} from 'react-intl';
import {Link} from 'react-router';
import {addHundredTodos, clearAll} from '../../todos/actions';
import {getNewTodo, getTodos} from '../../todos/store';
import {msg} from '../../intl/store';
import {state} from '../../state';

// Leverage webpack require goodness for feature toggle based dead code removal.
require('../../../../assets/css/todos.styl');

// Naïve undo implementation.
// TODO: Reimplement it.
const undoStates = [];

export default class Index extends React.Component {

  componentDidMount() {
    state.on('change', this.onStateChange);
    document.addEventListener('keypress', this.onDocumentKeypress);
  }

  componentWillUnmount() {
    state.removeListener('change', this.onStateChange);
    document.removeEventListener('keypress', this.onDocumentKeypress);
  }

  onStateChange(state) {
    undoStates.push(state);
  }

  onDocumentKeypress(e) {
    // Press shift+ctrl+s to save app state and shift+ctrl+l to load.
    if (!e.shiftKey || !e.ctrlKey) return;
    switch (e.keyCode) {
      case 19:
        window._appState = state.save();
        window._appStateString = JSON.stringify(window._appState);
        /*eslint-disable no-console */
        console.log('app state saved');
        console.log('copy the state to your clipboard by calling copy(_appStateString)');
        console.log('for dev type _appState and press enter');
        /*eslint-enable */
        break;
      case 12:
        const stateStr = window.prompt('Path the serialized state into the input'); // eslint-disable-line no-alert
        const newState = JSON.parse(stateStr);
        if (!newState) return;
        state.load(newState);
        break;
    }
  }

  undo() {
    undoStates.pop();
    state.set(undoStates.pop());
  }

  render() {
    // This is just a demo. In real app you would set first undo elsewhere.
    if (!undoStates.length) undoStates.push(state.get());

    // This is composite component. It load its data from store, and passes them
    // through props, so NewTodo and TodoList can leverage PureComponent.
    const newTodo = getNewTodo();
    const todos = getTodos();

    return (
      <DocumentTitle title="Todos">

          <NewTodo todo={newTodo} />
          <TodoList todos={todos} />

            <button
              children={msg('todos.clearAll')}
              disabled={!todos.size}
              onClick={clearAll}
            />
            <button
              children={msg('todos.add100')}
              onClick={addHundredTodos}
            />
            <button
              disabled={undoStates.length === 1}
              onClick={() => this.undo()}
            ><FormattedMessage
              message={msg('todos.undo')}
              steps={undoStates.length - 1}
            /></button>

            Things to Check

View page source, take a look how app is server rendered with initial data.

Open console, take a look how actions are logged from src/client/dispatcher.js.

              Development mode (gulp), try livereload styles or
              live-editing React components without app refresh.

              Production mode (gulp -p), to check built app performance and size.

              Isomorphic <Link to="/this-is-not-the-web-page-you-are-looking-for">
              404</Link> page.

Undo button.

              Global immutable app state, have you seen this
              video? Try shift+ctrl+s to save app state, and
              shift+ctrl+l to reload.

                Advanced performance with PureRenderMixin.

              ftlabs/fastclick
               to remove click delays on browsers with touch UIs.

              formatjs.io localization with
              polyfill for browsers without native Intl.

... and much more.

      </DocumentTitle>
    );
  }

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ImportSpecifier = ImportSpecifier;
exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
exports.ExportSpecifier = ExportSpecifier;
exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
exports.ExportAllDeclaration = ExportAllDeclaration;
exports.ExportNamedDeclaration = ExportNamedDeclaration;
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
exports.ImportDeclaration = ImportDeclaration;
exports.ImportAttribute = ImportAttribute;
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;

var t = _interopRequireWildcard(require("@babel/types"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ImportSpecifier(node) {
  if (node.importKind === "type" || node.importKind === "typeof") {
    this.word(node.importKind);
    this.space();
  }

  this.print(node.imported, node);

  if (node.local && node.local.name !== node.imported.name) {
    this.space();
    this.word("as");
    this.space();
    this.print(node.local, node);
  }
}

function ImportDefaultSpecifier(node) {
  this.print(node.local, node);
}

function ExportDefaultSpecifier(node) {
  this.print(node.exported, node);
}

function ExportSpecifier(node) {
  this.print(node.local, node);

  if (node.exported && node.local.name !== node.exported.name) {
    this.space();
    this.word("as");
    this.space();
    this.print(node.exported, node);
  }
}

function ExportNamespaceSpecifier(node) {
  this.token("*");
  this.space();
  this.word("as");
  this.space();
  this.print(node.exported, node);
}

function ExportAllDeclaration(node) {
  this.word("export");
  this.space();

  if (node.exportKind === "type") {
    this.word("type");
    this.space();
  }

  this.token("*");
  this.space();
  this.word("from");
  this.space();
  this.print(node.source, node);
  this.semicolon();
}

function ExportNamedDeclaration(node) {
  if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
    this.printJoin(node.declaration.decorators, node);
  }

  this.word("export");
  this.space();
  ExportDeclaration.apply(this, arguments);
}

function ExportDefaultDeclaration(node) {
  if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
    this.printJoin(node.declaration.decorators, node);
  }

  this.word("export");
  this.space();
  this.word("default");
  this.space();
  ExportDeclaration.apply(this, arguments);
}

function ExportDeclaration(node) {
  if (node.declaration) {
    const declar = node.declaration;
    this.print(declar, node);
    if (!t.isStatement(declar)) this.semicolon();
  } else {
    if (node.exportKind === "type") {
      this.word("type");
      this.space();
    }

    const specifiers = node.specifiers.slice(0);
    let hasSpecial = false;

    for (;;) {
      const first = specifiers[0];

      if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
        hasSpecial = true;
        this.print(specifiers.shift(), node);

        if (specifiers.length) {
          this.token(",");
          this.space();
        }
      } else {
        break;
      }
    }

    if (specifiers.length || !specifiers.length && !hasSpecial) {
      this.token("{");

      if (specifiers.length) {
        this.space();
        this.printList(specifiers, node);
        this.space();
      }

      this.token("}");
    }

    if (node.source) {
      this.space();
      this.word("from");
      this.space();
      this.print(node.source, node);
    }

    this.semicolon();
  }
}

function ImportDeclaration(node) {
  var _node$attributes;

  this.word("import");
  this.space();

  if (node.importKind === "type" || node.importKind === "typeof") {
    this.word(node.importKind);
    this.space();
  }

  const specifiers = node.specifiers.slice(0);

  if (specifiers == null ? void 0 : specifiers.length) {
    for (;;) {
      const first = specifiers[0];

      if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
        this.print(specifiers.shift(), node);

        if (specifiers.length) {
          this.token(",");
          this.space();
        }
      } else {
        break;
      }
    }

    if (specifiers.length) {
      this.token("{");
      this.space();
      this.printList(specifiers, node);
      this.space();
      this.token("}");
    }

    this.space();
    this.word("from");
    this.space();
  }

  this.print(node.source, node);

  if ((_node$attributes = node.attributes) == null ? void 0 : _node$attributes.length) {
    this.space();
    this.word("with");
    this.space();
    this.printList(node.attributes, node);
  }

  this.semicolon();
}

function ImportAttribute(node) {
  this.print(node.key);
  this.token(":");
  this.space();
  this.print(node.value);
}

function ImportNamespaceSpecifier(node) {
  this.token("*");
  this.space();
  this.word("as");
  this.space();
  this.print(node.local, node);
}


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>L-Index</title>
<meta name="date" content="2014-01-14">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I J K L M N O P Q R S T U V W X

L

LastnameRandomiser - Class in generator.randomisers

LastnameRandomiser() - Constructor for class generator.randomisers.LastnameRandomiser

Creates a new instance of FirstnameRandomiser

LEFT_MARK - Static variable in class generator.misc.Constants

leftOver - Variable in class generator.misc.AbstractEntityEventNode

ListItemsSequencer - Class in generator.randomisers

ListItemsSequencer() - Constructor for class generator.randomisers.ListItemsSequencer

ListRandomiser - Class in generator.randomisers

ListRandomiser() - Constructor for class generator.randomisers.ListRandomiser

Creates a new instance of NumIntegerRandomiser

loadClass(String) - Method in class generator.jarloader.MultiClassLoader

This is a simple version for external clients since they
 will always want the class resolved before it is returned
 to them.

loadClass(String, boolean) - Method in class generator.jarloader.MultiClassLoader

loadClassBytes(String) - Method in class generator.jarloader.JarClassLoader

loadClassBytes(String) - Method in class generator.jarloader.MultiClassLoader

loadDataFileDefinitions(String) - Method in class generator.misc.Utils

loadDataFileDefinitions_old() - Method in class generator.misc.Utils

Deprecated.

loadDBDriversInfo(String) - Method in class generator.misc.Utils

loadDBFileDefinitions(String) - Method in class generator.misc.Utils

loadDBGeneratorConfigFiles(Logger) - Static method in class generator.stagebuild.impl.ConfigFilesLoader

Loads all the configuration related to a DB generation

loadExistingDefinition(String) - Method in class generator.gui.FileOutputPanel

Loads the file definition populating the various
 components.

loadFileGeneratorConfigFiles(Logger, StageBuilderConfig) - Static method in class generator.stagebuild.impl.ConfigFilesLoader

Loads all the configuration files related to a file generation.

loadIcons() - Method in class generator.gui.db.DBDriversPanel

loadRandomiserInstances() - Method in class generator.misc.Utils

loadRandomiserInstances(String) - Method in class generator.misc.Utils

loadRandomiserTypes(String) - Method in class generator.misc.Utils

loadSQLJavaMappings(String) - Method in class generator.misc.Utils

loadStageDataContext(String) - Method in class generator.misc.ApplicationContext

loadStageDataContextData(String) - Method in class generator.masterbuild.MasterBuilder

Loads the master conf file from file.

loadStageDataContextData(String) - Method in class generator.misc.Utils

loadTreeData(DefaultMutableTreeNode, Vector) - Method in class generator.gui.MainForm

Loads the vector of data-types in a specific tree node.

logger - Variable in class generator.stagebuild.impl.AbstractBuilder

LongSequencer - Class in generator.randomisers

LongSequencer() - Constructor for class generator.randomisers.LongSequencer

A B C D E F G H I J K L M N O P Q R S T U V W X

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
angular.module('capstone')
app.controller('listCtrl', function($scope, $location, firebaseFactory) {

  $scope.tags = [];
  $scope.name = "list";

  firebaseFactory.getFirebaseRecipe()
    .then(function(data) {
      $scope.recipes = data;
      console.log(data)
    }).then(() => {
      $scope.$apply();
    });

  $scope.goToRecipe = function(recipe) {
    $location.path('/view/' + recipe);
  }

});


text:
<!DOCTYPE html>

    <title>ImageMagick: Command-line Tools</title>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  <meta name="application-name" content="ImageMagick"/>
  <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves."/>
  <meta name="application-url" content="http://www.imagemagick.org"/>
  <meta name="generator" content="PHP"/>
  <meta name="keywords" content="command-line, tools, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
  <meta name="rating" content="GENERAL"/>
  <meta name="robots" content="INDEX, FOLLOW"/>
  <meta name="generator" content="ImageMagick Studio LLC"/>
  <meta name="author" content="ImageMagick Studio LLC"/>
  <meta name="revisit-after" content="2 DAYS"/>
  <meta name="resource-type" content="document"/>
  <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
  <meta name="distribution" content="Global"/>
  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
  <link rel="icon" href="../images/wand.png"/>
  <link rel="shortcut icon" href="../images/wand.ico"/>
  <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900,400,400italic,700,700italic,300,300italic|Open+Sans:300italic,400italic,700italic,300,400,600,700"  >
  <link rel="stylesheet" type="text/css" href="css/magick.css"/>

      Home
      Download
      Tools
      Command-line
      Resources
      Develop
      Search
      Community

ImageMagick includes a number of command-line utilities for manipulating images.  Most of you are probably accustomed to editing images one at a time with a graphical user interface (GUI) with such programs as gimp or Photoshop.  However, a GUI is not always convenient.  Suppose you want to process an image dynamically from a web script or you want to apply the same operations to many images or repeat a specific operation at different times to the same or different image.  For these types of operations, the command-line image processing utility is appropriate.

The ImageMagick command-line tools exit with a status of 0 if the command line arguments have a proper syntax and no problems are encountered.  Expect a descriptive message and an exit status of 1 if any exception occurs such as improper syntax, a problem reading or writing an image, or any other problem that prevents the command from completing successfully.

Here is a short description for each command-line tool. Click on the program name to get details about the program usage and a list of command-line options that alters how the program behaves.  If you are just getting acquainted with ImageMagick, start with the magick program.  Be sure to peruse Anthony Thyssen's tutorial on how to use ImageMagick utilities to create, edit, compose, or convert images from the command-line.

animate

animate an image sequence on any X server.

compare

mathematically and visually annotate the difference between an image and its reconstruction.

composite

overlap one image over another.

conjure

interpret and execute scripts written in the Magick Scripting Language (MSL).

convert

convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

display

display an image or image sequence on any X server.

identify

describe the format and characteristics of one or more image files.

import

save any visible window on an X server and outputs it as an image file. You can capture a single window, the entire screen, or any rectangular portion of the screen.

mogrify

resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.  Mogrify overwrites the original image file, whereas, convert writes to a different image file.

montage

create a composite image by combining several separate images.  The images are tiled on the composite image optionally adorned with a border, frame, image name, and more.

stream

a lightweight tool to stream one or more pixel components of the image or portion of the image to your choice of storage formats.  It writes the pixel components as they are read from the input image a row at a time making stream desirable when working with large images or when you require raw pixel components.

Donate •
     Sitemap •
    Related •
    Security •
    Architecture

Back to top •
    Public Key •
    Contact Us

©  1999-2016 ImageMagick Studio LLC


text:
"""
Project 2 - stochastic resonance
"""
from __future__ import division
import sys
from PyDSTool import *
from common_lib import *
from Ch9_HH_red import *

# default dopri -- you will extremely long waits with Vode!
gentype='dopri'

# Parameter An = noise amplitude
#           As = sine wave amplitude
#           f = frequency, should be 55 Hz for this project
# Don't change any of the parameters for this project except As and An!
par_args = {'tau_v': 0.8, 'tau_r': 3,
            'As': 0., 'f': 55, 'An': 0., 'Iapp': 0.01}
ic_args = {'v':-0.75, 'r': 0.5}

# build neuron model
HH = makeHHneuron('HHred_noise', par_args, ic_args, const_I=True, gentype=gentype)

# set special conditions for using noise
HH.eventstruct.setActiveFlag('min_ev', False)
HH.set(tdata=[0,50])  # this is just a temporary value, you will change this later
if gentype == 'vode':
    HH.set(algparams={'init_step': 0.02, 'stiff': False})
else:
    HH.set(algparams={'init_step': 0.08})

# PUT YOUR CODE AFTER HERE!


text:
<?php include(STATIC_DIR.'/inc/header_inner.php'); ?>

<?php if($permissions->add_article) { ?>
Add a new article
<?php }?>

<?php
	if($articles) {
?>

			Title
			Date

		<?php foreach ($articles as $article) { ?>

			<?= $article->name ?>
			<?php
					$date = explode ('-', $article->date);
					$datep = $date[2].'/'.$date[1].'/'.$date[0];
					echo $datep;
				?>

				<?php if($permissions->delete_article) { ?>
				<form action="" method="POST">
					<input type="hidden" value="delete" name="action">
					<input type="hidden" value="<?= $article->id ?>" name="id">
					<button type="submit" class="uim-button delete red">Delete</button>
				</form>
				<?php } ?>
				<?php if($permissions->publish_article) { ?>
				<form action="" method="POST">
					<input type="hidden" value="publish" name="action">
					<input type="hidden" value="<?= $article->id ?>" name="id">
					<button type="submit" class="uim-button published <?= ($article->published ? "green" : "red")?>"><?= ($article->published ? "Published" : "Unpublished")?></button>
				</form>
				<?php } ?>
				<?php if($permissions->edit_article) { ?>
				<form action="/mightycms/articles/edit" method="POST">
					<input type="hidden" value="edit" name="action">
					<input type="hidden" value="<?= $article->id ?>" name="id">
					<button type="submit" class="uim-button edit blue">Edit</button>
				</form>
				<?php }?>

		<?php } ?>

<?php } ?>

<?php if($permissions->add_article) { ?>
Add a new article
<?php }?>

<?php include(STATIC_DIR.'/inc/footer_inner.php'); ?>


text:
require_dependency 'spree/shipment'

module ShipmentDelayedExtension
  def self.included(base)
    base.class_eval do
      def send_shipped_email
        ShipmentMailer.delay(queue: "mail").shipped_email(self.id).deliver
      end
    end
  end
end

Spree::Shipment.send(:include, ShipmentDelayedExtension)


text:
export default function nthArg(num: number) {
	return function () {
		return arguments[num];
	};
}


text:
package com.thinkgem.jeesite.modules.pro.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.pro.entity.ProTapeEmpty;
import com.thinkgem.jeesite.modules.pro.dao.ProTapeEmptyDao;

/**
 * 空白磁带Service
 * @author lin
 * @version 2016-05-18
 */
@Service
@Transactional(readOnly = true)
public class ProTapeEmptyService extends CrudService<ProTapeEmptyDao, ProTapeEmpty> {

	public ProTapeEmpty get(String id) {
		return super.get(id);
	}

	public List<ProTapeEmpty> findList(ProTapeEmpty proTapeEmpty) {
		return super.findList(proTapeEmpty);
	}

	public Page<ProTapeEmpty> findPage(Page<ProTapeEmpty> page, ProTapeEmpty proTapeEmpty) {
		return super.findPage(page, proTapeEmpty);
	}

	@Transactional(readOnly = false)
	public void save(ProTapeEmpty proTapeEmpty) {
		super.save(proTapeEmpty);
	}

	@Transactional(readOnly = false)
	public void delete(ProTapeEmpty proTapeEmpty) {
		super.delete(proTapeEmpty);
	}

}


text:
package org.apache.commons.betwixt.strategy;

import org.apache.commons.betwixt.XMLUtils;

/**
 * NameMapper implementation that processes a name by replacing or stripping
 * illegal characters before passing result down the chain.
 *
 * @author Robert Burrell Donkin
 * @since 0.5
 */
public class BadCharacterReplacingNMapper implements NameMapper {
   /** Next mapper in chain, possibly null */
   private final NameMapper chainedMapper;
   /** Replacement character, possibly null */
   private Character replacement = null;

   /**
    * Constructs a replacing mapper which delegates to given mapper.
    * @param chainedMapper next link in processing chain, possibly null
    */
   public BadCharacterReplacingNMapper(NameMapper chainedMapper) {
      this.chainedMapper = chainedMapper;
   }

   /**
    * Sets the character that should be used to replace bad characters.
    * @param replacement the Charcter to be used for replacement if not null.
    * Otherwise, indicates that illegal characters should be deleted.
    */
   public void setReplacement(Character replacement) {
      this.replacement = replacement;
   }

   /**
    * This implementation processes characters which are not allowed in xml
    * element names and then returns the result from the next link in the chain.
    * This processing consists of deleting them if no replacement character
    * has been set.
    * Otherwise, the character will be replaced.
    *
    * @param typeName the string to convert
    * @return the processed input
    */
   public String mapTypeToElementName(String typeName) {

      StringBuilder buffer = new StringBuilder(typeName);
      for (int i = 0, size = buffer.length(); i < size; i++) {
         char nextChar = buffer.charAt(i);
         boolean bad;
         if (i == 0) {
            bad = !XMLUtils.isNameStartChar(nextChar);
         } else {
            bad = !XMLUtils.isNameChar(nextChar);
         }

         if (bad) {
            if (replacement != null) {
               buffer.setCharAt(i, replacement.charValue());
            } else {
               // delete
               buffer.deleteCharAt(i);
               i--;
               size--;
            }
         }
      }

      if (buffer.length() == 0) {
         throw new IllegalArgumentException(
               "Element name contains no legal characters and no replacements have been set.");
      }

      typeName = buffer.toString();

      if (chainedMapper == null) {
         return typeName;
      }
      return chainedMapper.mapTypeToElementName(typeName);
   }
}


text:
@interface TestMakeDestinationViewController : UIViewController

@end


text:
package org.chocosolver.solver.search.strategy.decision;

import org.chocosolver.solver.ICause;
import org.chocosolver.solver.Identity;
import org.chocosolver.solver.exception.ContradictionException;
import org.chocosolver.solver.exception.SolverException;
import org.chocosolver.solver.explanations.Deduction;
import org.chocosolver.solver.explanations.Explanation;
import org.chocosolver.solver.explanations.ExplanationEngine;
import org.chocosolver.solver.variables.Variable;

/**
 * <br/>
 *
 * @author Charles Prud'homme
 * @since 2 juil. 2010
 */
public abstract class Decision<V extends Variable> implements Identity, ICause, Comparable<Decision<V>> {

    public static int _ID = 0;

    final int id;

    protected V var;

    // 0: not applied yet, 1: applied once, 2: refute once
    protected int branch;

    int worldIndex; // indication on the world in which it has been selected

    protected Decision previous;

    protected boolean once;

    public Decision() {
        id = _ID++;
    }

    @Override
    public final int getId() {
        return id;
    }

    /**
     * Set the previous decision applied in the tree search
     *
     * @param decision previous decision
     */
    public void setPrevious(Decision decision) {
        this.previous = decision;
    }

    /**
     * Return the previous decision applied in the tree search
     *
     * @return the previous decision
     */
    public Decision getPrevious() {
        return previous;
    }

    public void setWorldIndex(int wi) {
        this.worldIndex = wi;
    }

    public int getWorldIndex() {
        return worldIndex;
    }

    /**
     * Return true if the decision can be refuted
     *
     * @return true if the decision can be refuted, false otherwise
     */
    public boolean hasNext() {
        return branch < 2 && !once;
    }

    /**
     * Build the refutation, hasNext() must be called before
     */
    public void buildNext() {
        branch++;
    }

    /**
     * Should this decision be a one-shot decision, non refutable.
     * @param once a boolean
     */
    public void once(boolean once) {
        this.once = once;
    }

    protected void set(V var){
        this.var = var;
        branch = 0;
        this.once = false;
        this.setWorldIndex(var.getSolver().getEnvironment().getWorldIndex());
    }

    /**
     * Apply the current decision
     *
     * @throws ContradictionException
     */
    public abstract void apply() throws ContradictionException;

    /**
     * Force the decision to be in its creation state.
     */
    public void rewind() {
        branch = 0;
    }

    /**
     * Return the variable object involves in the decision
     *
     * @return a variable V
     */
    public V getDecisionVariable() {
        return var;
    }

    /**
     * Return the value object involves in the decision
     *
     * @return a value object
     */
    public abstract Object getDecisionValue();

    /**
     * Free the decision, ie, it can be reused
     */
    public abstract void free();

    /**
     * Reverse the decision operator
     */
    public void reverse() {
        throw new UnsupportedOperationException();
    }

    public Decision<V> duplicate() {
        throw new UnsupportedOperationException();
    }

    @Override
    public void explain(ExplanationEngine xengine, Deduction d, Explanation e) {
        if (branch == 1) {
            e.add(xengine.explain(getPositiveDeduction(xengine)));
        } else if (branch == 2) {
            e.add(xengine.explain(getNegativeDeduction(xengine)));
        } else {
            throw new SolverException("Cannot explain a decision which has not been applied or refuted: "+ this);
        }
    }

    public Deduction getNegativeDeduction(ExplanationEngine xengine) {
        return xengine.getDecision(this, false);
    }

    public Deduction getPositiveDeduction(ExplanationEngine xengine) {
        return xengine.getDecision(this, true);
    }

    @Override
    public int compareTo(Decision<V> o) {
        if (o.getDecisionVariable().getId() == this.getDecisionVariable().getId()
                && o.getDecisionValue().equals(this.getDecisionValue())) {
            return 0;
        }
        return 1;
    }
}


text:
<?php

namespace spec\Sylius\Component\Payment\Model;

use PhpSpec\ObjectBehavior;
use Sylius\Component\Payment\Calculator\FeeCalculatorInterface;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class PaymentMethodSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Component\Payment\Model\PaymentMethod');
    }

    function it_implements_sylius_payment_method_interface()
    {
        $this->shouldImplement('Sylius\Component\Payment\Model\PaymentMethodInterface');
    }

    function it_has_no_id_by_default()
    {
        $this->getId()->shouldReturn(null);
    }

    function it_is_unnamed_by_default()
    {
        $this->getName()->shouldReturn(null);
    }

    function its_name_is_mutable()
    {
        $this->setName('Stripe');
        $this->getName()->shouldReturn('Stripe');
    }

    function it_is_convertable_to_string_and_returns_its_name()
    {
        $this->setName('PayPal');
        $this->__toString()->shouldReturn('PayPal');
    }

    function it_has_no_description_by_default()
    {
        $this->getDescription()->shouldReturn(null);
    }

    function its_description_is_mutable()
    {
        $this->setDescription('Pay by check.');
        $this->getDescription()->shouldReturn('Pay by check.');
    }

    function it_has_no_gateway_by_default()
    {
        $this->getGateway()->shouldReturn(null);
    }

    function its_gateway_is_mutable()
    {
        $this->setGateway('paypal');
        $this->getGateway()->shouldReturn('paypal');
    }

    function it_has_no_app_environment_by_default()
    {
        $this->getEnvironment()->shouldReturn(null);
    }

    function its_app_environment_is_mutable()
    {
        $this->setEnvironment('dev');
        $this->getEnvironment()->shouldReturn('dev');
    }

    function it_is_enabled_by_default()
    {
        $this->shouldBeEnabled();
    }

    function it_allows_disabling_itself()
    {
        $this->setEnabled(false);
        $this->shouldNotBeEnabled();
    }

    function it_initializes_creation_date_by_default()
    {
        $this->getCreatedAt()->shouldHaveType('DateTime');
    }

    function it_has_no_last_update_date_by_default()
    {
        $this->getUpdatedAt()->shouldReturn(null);
    }

    function its_fee_calculator_is_mutable()
    {
        $this->getFeeCalculator()->shouldReturn('fixed');

        $this->setFeeCalculator('test_calculator');
        $this->getFeeCalculator()->shouldReturn('test_calculator');
    }

    function its_fee_calculator_configuration_is_mutable()
    {
        $this->setFeeCalculatorConfiguration(array('amount' => 10));
        $this->getFeeCalculatorConfiguration()->shouldReturn(array('amount' => 10));
    }
}


text:
QueryScript Flow Control: foreach statement

SYNOPSIS

foreach ($var1 [, $var2...] : collection)
{
  statement;
  statement, typically using $var1 [, $var2...];
}
[otherwise
  statement;]

DESCRIPTION

foreach is a flow control looping structure. It iterates collections of various
types, assigns iterated values onto variables, and executes statements per iteration.

foreach iterates all elements in given collection, and executes a statement (or block of statements) per element.
foreach terminates when all elements have been processed. The break and
return statements also break iteration execution.

As opposed to the foreach() routine, foreach loops can be nested within other flow control structures,
such as
if-else,
while,
loop-while and
foreach itself (see examples below).
read more about the difference between the foreach control flow and the foreach() routine following.

	The otherwise clause is optional. It will execute once should no iteration
	take place. That is, if at least one collection element exists,
	otherwise is skipped.

Variables

The foreach construct is also a variable declaration point. Variables are created
and are assigned to, per loop iteration. As with the var statement, at least one variable is expected
on foreach clause.

Any variables declared in the foreach clause are assigned with values as per iteration element.
There are various types of collections, as described following. These can vary from SELECT statements to number ranges.
Elements within collections can be single-valued or multi-valued. To illustrate, consider these examples:

foreach($counter: 1:1024)
{
  -- Collection is of numbers-range type. It is single valued.
  -- Do something with $counter
}

In the above example, a single variable, named $counter is declared. It is assigned with the integer values
1, 2, 3, ..., 1024, one value per iteration.

foreach($name, $pop: SELECT Name, Population FROM world.Country)
{
  -- Collection is of query type. It may hold up to 9 values (generated by 9 first columns).
  -- Do something with $name and $pop.
}

In this example, the SELECT query returns 2 columns: Name and Population,
which we assign onto the variables $name and $pop, respectively. This happens per row in query's result set.

At least one variable must be declared. However, it is OK to list less than the amount of variables available from the collection. Hence, the following
is valid:

foreach($name: SELECT Name, Population FROM world.Country)
{
  -- Do something with $name. We never bother to actually read the Population value.
}

Variable expansion is of importance, as it allows using variable names in place of constants which are otherwise non-dynamic,
such as schema or table names. Read more on Variables before checking up on the examples.

Collection variables

	Collections (described following) may themselves use local variables, as well as expanded
	variables.

Collections

foreach accepts several types of collections. They are automatically recognized by their
pattern. The following collections are recognized (also see EXAMPLES section below):

A SELECT query: any SELECT statement makes for a collection,
		which is the result set of the query.

Each row in the result set is an element.

The query must specify result columns. That is, a SELECT * query is not valid.

Otherwise any SELECT query is valid, with any result set. However, only first 9
		columns in the result set can be assigned to variables. Variables are matched to columns by order of definition.

Column values are treated as text, even though they may originally be of other types.

Numbers range: a range of integers, both inclusive, e.g. '1970:2038'.

Negative values are allowed. The first (left) value should be smaller or equal to the second (right) value,
		or else no iteration is performed.

One variable is assigned with value on this collection.

Two dimensional numbers range: a double range of integers, e.g. '-10:10,1970:2038'.

Each one of the ranges answers to the same rules as for a single range.

There will be m * n iterations on ranges of size m and n. For example,
		in the sample range above there will be 11 * 69 iterations (or elements).

Two variables are assigned with values on this collection.

This type of collection is maintained in compatibility with the foreach() routine.
		Script-wise, though, it is perfectly possible to nest two foreach number-ranges loops.

A constants set: a predefined set of constant values, e.g. '{red, green, blue}'.

Constants are separated by either spaces or commas (or both).

Constants can be quoted so as to allow spaces or commas within constant value. Quotes themselves are discarded.

Empty constants are discarded.

One variable is assigned with value on this collection.

'schema': this is the collection of available schemata (e.g. as with SHOW DATABASES).

One variable is assigned with value on this collection. This value is the name of the schema.

'schema like expr': databases whose names match the given LIKE expression.

One variable is assigned with value on this collection. This value is the name of the schema.

'schema ~ 'regexp'': databases whose names match the given regular expression.

One variable is assigned with value on this collection. This value is the name of the schema.

'table in schema_names': collection of all tables in given schema. Only tables are included: views are not listed.

This syntax is INFORMATION_SCHEMA friendly, in that it only scans and opens .frm files for
		given schema.

An element of this collection has 4 values, which can be mapped up to 4 variables:

Table name

Schema name

Storage engine name

Table's create options

'table like expr': all tables whose names match the given LIKE expression. These can be tables
		from different databases/schemata.

This syntax is INFORMATION_SCHEMA friendly, in that it only scans and opens .frm files for
		a single schema at a time. This reduces locks and table cache entries, while potentially taking longer to complete.

An element of this collection has 4 values, which can be mapped up to 4 variables:

Table name

Schema name

Storage engine name

Table's create options

'table ~ 'regexp'': all tables whose names match the given regular expression. These can be tables
		from different databases/schemata.

This syntax is INFORMATION_SCHEMA friendly, in that it only scans and opens .frm files for
		a single schema at a time. This reduces locks and table cache entries, while potentially taking longer to complete.

An element of this collection has 4 values, which can be mapped up to 4 variables:

Table name

Schema name

Storage engine name

Table's create options

Any other type of input raises an error.

Following is a brief sample of valid foreach expressions:

Collection type	Example of valid input

SELECT query	$id, $n: SELECT id, name FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time > 20

Numbers range	$year: 1970:2038

Two dimensional numbers range	$hr, $minute: 0:23,0:59

Constants set	$country: {USA, "GREAT BRITAIN", FRA, IT, JP}

'schema'	$schema_name: schema

'schema like expr'	$customer_schema_name: schema like customer_%

'schema ~ 'regexp''	$customer_schema_name: schema ~ '^customer_[0-9]+$'

'table in schema_name'	$table_name, $schema_name, $engine, $create_options: table in sakila

'table like expr'	$table_name, $schema_name, $engine: table like wp_%

'table ~ 'regexp''	$table_name, $schema_name: table ~ '^state_[A-Z]{2}$'

EXAMPLES

SELECT query

		Kill queries for user 'analytics'.

foreach($id: SELECT id FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user = 'analytics')
  KILL QUERY :$id;

		(But see also killall())

		Select multiple columns; execute multiple queries based on those columns:

foreach($code, $name: SELECT Code, Name FROM world.Country WHERE Continent='Europe')
{
  DELETE FROM world.CountryLanguage WHERE CountryCode = $code;
  DELETE FROM world.City WHERE CountryCode = $code;
  DELETE FROM world.Country WHERE Code = $code;
  INSERT INTO test.logs (msg) VALUES (CONCAT('deleted country: name=', $name));
}

Numbers range:

		Delete records from July-August for years 2001 - 2009:

foreach($year: 2001:2009)
  DELETE FROM sakila.rental WHERE rental_date >= CONCAT($year, '-07-01') AND rental_date < CONCAT($year, '-09-01');

		Generate tables:

foreach($i: 1:8)
  CREATE TABLE test.t_:${i} (id INT);

SHOW TABLES FROM test;
+----------------+
| Tables_in_test |
+----------------+
| t_1            |
| t_2            |
| t_3            |
| t_4            |
| t_5            |
| t_6            |
| t_7            |
| t_8            |
+----------------+

Constants set:

		Generate databases:

foreach($shard: {US, GB, Japan, FRA})
  CREATE DATABASE dbshard_:${shard};

show databases LIKE 'dbshard_%';
+----------------------+
| Database (dbshard_%) |
+----------------------+
| dbshard_FRA          |
| dbshard_GB           |
| dbshard_Japan        |
| dbshard_US           |
+----------------------+

'schema':

		List full tables on all schemata:

foreach($scm: schema)
  SHOW FULL TABLES FROM :$scm;
+---------------------------------------+-------------+
| Tables_in_information_schema          | Table_type  |
+---------------------------------------+-------------+
| CHARACTER_SETS                        | SYSTEM VIEW |
| COLLATIONS                            | SYSTEM VIEW |
| COLLATION_CHARACTER_SET_APPLICABILITY | SYSTEM VIEW |
| COLUMNS                               | SYSTEM VIEW |
| COLUMN_PRIVILEGES                     | SYSTEM VIEW |
...
+---------------------------------------+-------------+

...

+-----------------+------------+
| Tables_in_world | Table_type |
+-----------------+------------+
| City            | BASE TABLE |
| Country         | BASE TABLE |
| CountryLanguage | BASE TABLE |
| Region          | BASE TABLE |
+-----------------+------------+

'schema like expr':

		Create a new table in all hosted WordPress schemata:

foreach($scm: schema like wp%)
{
  CREATE TABLE :$scm.wp_likes(id int, data VARCHAR(128));
}

'schema ~ 'regexp'':

		Likewise, be more accurate on schema name:

foreach ($scm: schema ~ '^wp_[\d]+$')
{
  CREATE TABLE :$scm.wp_likes(id int, data VARCHAR(128));
}

'table in schema_name':

		Compress InnoDB tables in sakila. Leave other engines untouched.

foreach($table, $schema, $engine: table in sakila)
  if ($engine = 'InnoDB')
    ALTER TABLE :$schema.:$table ENGINE=InnoDB ROW_FORMAT=Compressed KEY_BLOCK_SIZE=8;

'table like expr':

		Add a column to all wp_posts tables in hosted WordPress databases:

foreach($tbl, $scm: table like wp_posts)
  ALTER TABLE :$scm.:$tbl ADD COLUMN post_geo_location VARCHAR(128);

'table ~ 'regexp'':

		Add a column to tables whose name matches the given regular expression, in any database:

foreach ($tbl, $scm: table ~ '^customer_data_[\d]+$')
  ALTER TABLE :$scm.:$tbl ADD COLUMN customer_geo_location VARCHAR(128);

Use an otherwise clause:

		The following collection will not match any table:

foreach ($table, $schema: table like non_existing_table_name_%)
  select $table, $schema;
otherwise
  echo 'No tables found';

+-------------------+
| echo              |
+-------------------+
| 'No tables found' |
+-------------------+

NOTES

foreach vs. foreach()

The foreach flow control structure and the foreach() routine both iterate collections, accept similar
(but not identical) collection syntax, and invoke scripts per loop iteration. They share some similar use cases, but are nevertheless different.

Very briefly, in Geekish, the differences are:

foreach() is more META.

foreach() cannot be nested, nor called from within a script.

foreach is more limited in terms of what it can do with iterated values.

To fully understand the differences, one must first be acquainted with variables expansion
. Consider the following example:

		foreach() routine

mysql> call foreach(
	'2001:2009',
	"DELETE FROM sakila.rental WHERE rental_date >= '${1}-07-01' AND rental_date < '${1}-09-01'");

		Iterated values are integers in the range 2001 - 2009. The placeholder ${1}
		is assigned with iterated value. The script (a single query in this case) never sees ${1} because
		the text of the script gets manipulated before being invoked. Thus, there are 9 different looking scripts
		invoked. For example, the second iteration would execute the following script:

DELETE FROM sakila.rental WHERE rental_date >= '2002-07-01' AND rental_date < '2002-09-01'

		Since placeholders make for text manipulation of the script even before it is invoked, the options are limit-less.
		There is no constraint on what can or cannot be used as placeholder, as long as the resulting manipulated text makes for a valid script.

		foreach flow control structure:

foreach($year: 2001:2009)
  DELETE FROM sakila.rental WHERE rental_date >= CONCAT($year, '-07-01') AND rental_date < CONCAT($year, '-09-01');

		The $year variable has the same limitations as any user-defined variable. It cannot be used from within a quoted text:
		'$year-07-01' is just a string, and the fact the term $year appears inside this quoted text means nothing.
		Hence, we must use CONCAT in order to build the date.

SEE ALSO

Variables,
while,
break,
foreach()

AUTHOR

Shlomi Noach


text:
namespace remoting {

// A PageLoadNotificationObserver allows code to wait until a give URL is loaded
// in any tab in any browser window, i.e. NotificationService::AllSources().
// This simple pattern is not easy to implement using
// WindowedNotificationObserver because we need to bind the observer object
// in the callback but we also need to provide the callback when constructing
// the observer object.
class PageLoadNotificationObserver
    : public content::WindowedNotificationObserver {
 public:
  explicit PageLoadNotificationObserver(const GURL& target);

  virtual ~PageLoadNotificationObserver();

 private:
  bool IsTargetLoaded();
  GURL target_;
  DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver);
};

}  // namespace remoting

#endif  // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_


text:
var canvas = document.getElementById("Collisions-canvas");
var ctx = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;
var Speed = 2;
var MaxSize= 30;
var Num = 2;
var allParticles=[];
var PI = 3.141592;
var maxSpeed = 10;
var maxDist =900;
var vectors = false;

function initializeParticles() {
	document.getElementById('numparticles').value=Num;
	for (var i = 0; i < Num; i++) {
		var particle = new Object();
		particle.radius = Math.random() * MaxSize;
		particle.position = new Object();
		particle.velocity = new Object();
		particle.newPosition = new Object();
		particle.newVelocity = new Object();
		particle.position.x = (Math.random() * (width-5))+5;
		particle.position.y = (Math.random() * (height-particle.radius))+particle.radius;
		particle.velocity.x = Math.random() * maxSpeed;
		particle.velocity.y = Math.random() * maxSpeed;
		particle.mass = particle.radius*particle.radius;
		particle.newVelocity.x=particle.velocity.x;
		particle.newVelocity.y=particle.velocity.y;
		allParticles.push(particle);
	}
}

function moveParticles(){
	for (var a = 0; a < allParticles.length; a++) {
		allParticles[a].newVelocity.y=allParticles[a].velocity.y;
		allParticles[a].newVelocity.x=allParticles[a].velocity.x;
		allParticles[a].newPosition.x=allParticles[a].position.x;
		allParticles[a].newPosition.y=allParticles[a].position.y;
		for (var b = 0; b < allParticles.length; b++) {
			var difX = (allParticles[a].position.x-allParticles[b].position.x);
			var difY = (allParticles[a].position.y-allParticles[b].position.y);
			var dist = Math.sqrt((Math.pow(difX,2)+Math.pow(difY,2)));
			var difX2 = difX;
			var difY2 = difY;
			var dist2 = dist;
			if(dist!=0&&dist<=(allParticles[a].radius+allParticles[b].radius)/*&&allParticles[a].cooldown<=0&&allParticles[b].cooldown<=0*/){

				var aSpeed = Math.sqrt(Math.pow(allParticles[a].velocity.x,2)+Math.pow(allParticles[a].velocity.y,2));
				var bSpeed = Math.sqrt(Math.pow(allParticles[b].velocity.x,2)+Math.pow(allParticles[b].velocity.y,2));

				while(bSpeed<=aSpeed&&/*allParticles[a].radius<=allParticles[b].radius&&*/dist2<(allParticles[a].radius+allParticles[b].radius)){
					difX2 = (allParticles[a].newPosition.x-allParticles[b].position.x);
					difY2 = (allParticles[a].newPosition.y-allParticles[b].position.y);
					dist2 =Math.sqrt((Math.pow(difX2,2)+Math.pow(difY2,2)));
					allParticles[a].newPosition.x=allParticles[a].newPosition.x-allParticles[a].velocity.x/10;
					allParticles[a].newPosition.y=allParticles[a].newPosition.y-allParticles[a].velocity.y/10;
				}

				allParticles[a].newVelocity.y=(((allParticles[a].velocity.y*(allParticles[a].mass-allParticles[b].mass))+(2*allParticles[b].mass*allParticles[b].velocity.y))/(allParticles[a].mass+allParticles[b].mass));

				allParticles[a].newVelocity.x=(((allParticles[a].velocity.x*(allParticles[a].mass-allParticles[b].mass))+(2*allParticles[b].mass*allParticles[b].velocity.x))/(allParticles[a].mass+allParticles[b].mass));

			}
		}
	}

	for (var a = 0; a < allParticles.length; a++) {
		allParticles[a].position.x=allParticles[a].newPosition.x;
		allParticles[a].position.y=allParticles[a].newPosition.y;
		allParticles[a].velocity.x=allParticles[a].newVelocity.x;
		allParticles[a].velocity.y=allParticles[a].newVelocity.y;
	}

	for (var x = 0; x < allParticles.length; x++) {
		allParticles[x].position.x+=allParticles[x].velocity.x;
		allParticles[x].position.y+=allParticles[x].velocity.y;
		if (allParticles[x].position.x >= canvas.width-(allParticles[x].radius/2)) {
			allParticles[x].velocity.x=-Math.abs(allParticles[x].velocity.x);
        	}
		if(allParticles[x].position.x <= (allParticles[x].radius)){
			allParticles[x].velocity.x=Math.abs(allParticles[x].velocity.x);
		}
		if (allParticles[x].position.y >= canvas.height-(allParticles[x].radius/2)) {
			allParticles[x].velocity.y = -Math.abs(allParticles[x].velocity.y);
		}
		if(allParticles[x].position.y <= (allParticles[x].radius)){
			allParticles[x].velocity.y = Math.abs(allParticles[x].velocity.y);
		}
	}
}

function drawParticles() {
	ctx.fillStyle = "rgba(255,255,255,.2)";
	ctx.fillRect(0, 0, canvas.width, canvas.height);
	for (var i = 0; i < allParticles.length; i++) {
		particle = allParticles[i];
		ctx.beginPath();
		var colorString = 'rgb(0,0,255)';
		ctx.strokeStyle = colorString;
		ctx.arc(particle.position.x /*- (charge.radius)*/, particle.position.y /*- (charge.radius)*/, particle.radius, 0, 2 * PI);
		ctx.fill();
		ctx.stroke();
		if(vectors){
			ctx.beginPath();-
			ctx.moveTo(particle.position.x,particle.position.y);
			ctx.lineTo((particle.position.x+(particle.velocity.x*particle.radius*particle.radius/3)),(particle.position.y+(particle.velocity.y*particle.radius*particle.radius/3)));
			ctx.fill();
			ctx.stroke();
		}
	}
	ctx.fillRect(0, 0, canvas.width, canvas.height);
}
initializeParticles();

$("#controls-submit").click(function() {
	Num = $("#numparticles").val();
	vectors = $("#vect").is(":checked");
	allParticles = [];
	initializeParticles();
});

function main() {
	moveParticles();
	drawParticles();
	requestAnimationFrame(main);
};
requestAnimationFrame(main);


text:
/**
 * This component operates as a "Controller-View".  It listens for changes in
 * the TodoStore and passes the new data to its children.
 */
import * as React from "react";
import { Footer } from "./Footer.react";
import { Header } from "./Header.react";
import { MainSection } from "./MainSection.react";
import { Context } from "almin";
import { appStoreGroup } from "../store/AppStoreGroup";

export interface TodoAppProps {
    appContext: Context<typeof appStoreGroup.state>;
}

// state is same with AppStoreGroup's state
export type TodoAppState = typeof appStoreGroup.state;

export class TodoApp extends React.Component<TodoAppProps, TodoAppState> {
    releaseChange = () => {};

    constructor(props: TodoAppProps) {
        super(props);
        const appContext = props.appContext;
        this.state = appContext.getState();
    }

    componentDidMount() {
        const appContext = this.props.appContext;
        this.releaseChange = appContext.onChange(() => {
            this.setState(appContext.getState());
        });
    }

    componentWillUnmount() {
        this.releaseChange();
    }

    render() {
        const todoState = this.state.todoState;
        return (
            <div>
                <Header />
                <MainSection allTodos={todoState.displayItems} areAllComplete={todoState.areAllComplete} />
                <Footer allTodos={todoState.items} filterType={todoState.filterType} />
            </div>
        );
    }
}


text:
.class final Lcom/kk/liushiwu/com/zz/b;
.super Landroid/content/BroadcastReceiver;

# instance fields
.field final synthetic a:Lcom/kk/liushiwu/com/zz/lanjie;

# direct methods
.method constructor <init>(Lcom/kk/liushiwu/com/zz/lanjie;)V
    .locals 0

    iput-object p1, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

# virtual methods
.method public final onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 10

    const/4 v1, 0x0

    invoke-static {p1}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v5

    :try_start_0
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    const-string v2, "android.provider.Telephony.SMS_RECEIVED"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    if-nez v0, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "p"

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const v3, 0x7f050007

    invoke-virtual {p1, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v3

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

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/os/Bundle;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [Ljava/lang/Object;

    array-length v6, v0

    new-array v7, v6, [Landroid/telephony/SmsMessage;

    const-string v3, ""

    const/4 v2, 0x0

    iget-object v4, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    const/4 v8, 0x0

    invoke-static {v4, v8}, Lcom/kk/liushiwu/com/zz/lanjie;->a(Lcom/kk/liushiwu/com/zz/lanjie;Z)V

    const-string v4, "key"

    const/4 v8, 0x1

    invoke-interface {v5, v4, v8}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v8

    move v4, v1

    :goto_1
    if-lt v4, v6, :cond_2

    iget-object v0, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    invoke-static {v0}, Lcom/kk/liushiwu/com/zz/lanjie;->a(Lcom/kk/liushiwu/com/zz/lanjie;)Z

    move-result v0

    if-nez v0, :cond_0

    if-nez v3, :cond_f

    const-string v0, ""

    move-object v1, v0

    :goto_2
    if-nez v2, :cond_e

    const-string v0, ""

    :goto_3
    if-eqz v8, :cond_0

    new-instance v2, Landroid/content/Intent;

    const-class v3, Lcom/kk/liushiwu/com/zz/bs;

    invoke-direct {v2, p1, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string v3, "android.intent.category.HOME"

    invoke-virtual {v2, v3}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    const-string v3, "mobile"

    invoke-virtual {v2, v3, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v0, "content"

    invoke-virtual {v2, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v2}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0

    :cond_2
    aget-object v1, v0, v4

    check-cast v1, [B

    invoke-static {v1}, Landroid/telephony/SmsMessage;->createFromPdu([B)Landroid/telephony/SmsMessage;

    move-result-object v1

    aput-object v1, v7, v4

    aget-object v1, v7, v4

    invoke-virtual {v1}, Landroid/telephony/SmsMessage;->getDisplayMessageBody()Ljava/lang/String;

    move-result-object v1

    if-eqz v2, :cond_3

    const-string v9, ""

    if-ne v2, v9, :cond_4

    :cond_3
    aget-object v2, v7, v4

    invoke-virtual {v2}, Landroid/telephony/SmsMessage;->getOriginatingAddress()Ljava/lang/String;

    move-result-object v2

    :cond_4
    if-nez v1, :cond_5

    const-string v1, ""

    :cond_5
    const-string v9, "1"

    invoke-virtual {v1, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-nez v9, :cond_6

    const-string v9, "0"

    invoke-virtual {v1, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-nez v9, :cond_6

    const-string v9, "fsdx"

    invoke-virtual {v1, v9}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v9

    if-nez v9, :cond_6

    const-string v9, "lxr"

    invoke-virtual {v1, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-nez v9, :cond_6

    const-string v9, "sydx"

    invoke-virtual {v1, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-nez v9, :cond_6

    const-string v9, "pb#"

    invoke-virtual {v1, v9}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v9

    if-eqz v9, :cond_c

    :cond_6
    iget-object v0, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    const/4 v3, 0x1

    invoke-static {v0, v3}, Lcom/kk/liushiwu/com/zz/lanjie;->a(Lcom/kk/liushiwu/com/zz/lanjie;Z)V

    iget-object v0, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    invoke-static {p0, p1}, Lcom/kk/liushiwu/com/zz/lanjie;->a(Landroid/content/BroadcastReceiver;Landroid/content/Context;)V

    new-instance v0, Landroid/content/Intent;

    const-class v3, Lcom/kk/liushiwu/com/zz/bs;

    invoke-direct {v0, p1, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string v3, "android.intent.category.HOME"

    invoke-virtual {v0, v3}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    const-string v3, "1"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_7

    invoke-interface {v5}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v1

    const-string v3, "key"

    const/4 v4, 0x1

    invoke-interface {v1, v3, v4}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    invoke-interface {v1}, Landroid/content/SharedPreferences$Editor;->commit()Z

    const-string v1, "delcontent"

    const-string v3, "1"

    invoke-virtual {v0, v1, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_7
    const-string v3, "0"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_8

    invoke-interface {v5}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v1

    const-string v3, "key"

    const/4 v4, 0x0

    invoke-interface {v1, v3, v4}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    invoke-interface {v1}, Landroid/content/SharedPreferences$Editor;->commit()Z

    const-string v1, "delcontent"

    const-string v3, "0"

    invoke-virtual {v0, v1, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_8
    const-string v3, "fsdx"

    invoke-virtual {v1, v3}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v3

    if-eqz v3, :cond_9

    const-string v3, "delcontent"

    invoke-virtual {v0, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_9
    const-string v3, "lxr"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_a

    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/kk/liushiwu/com/zz/br;

    invoke-direct {v0, p1, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string v1, "android.intent.category.HOME"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delcontent"

    const-string v3, "lxr"

    invoke-virtual {v0, v1, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "auto"

    const-string v2, "no"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_a
    const-string v3, "sydx"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_b

    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/kk/liushiwu/com/zz/br;

    invoke-direct {v0, p1, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string v1, "android.intent.category.HOME"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delcontent"

    const-string v3, "sydx"

    invoke-virtual {v0, v1, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "auto"

    const-string v2, "no"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_b
    const-string v3, "pb#"

    invoke-virtual {v1, v3}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    :try_start_1
    const-string v3, "#"

    invoke-virtual {v1, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v3

    const/4 v4, 0x1

    aget-object v3, v3, v4

    invoke-interface {v5}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v4

    const-string v5, "key1"

    invoke-interface {v4, v5, v3}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    invoke-interface {v4}, Landroid/content/SharedPreferences$Editor;->commit()Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :goto_4
    :try_start_2
    const-string v3, "delcontent"

    invoke-virtual {v0, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "delmobile"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto/16 :goto_0

    :cond_c
    new-instance v9, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v9, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

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

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    if-eqz v8, :cond_d

    iget-object v1, p0, Lcom/kk/liushiwu/com/zz/b;->a:Lcom/kk/liushiwu/com/zz/lanjie;

    invoke-static {p0, p1}, Lcom/kk/liushiwu/com/zz/lanjie;->a(Landroid/content/BroadcastReceiver;Landroid/content/Context;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    :cond_d
    add-int/lit8 v1, v4, 0x1

    move v4, v1

    goto/16 :goto_1

    :catch_1
    move-exception v3

    goto :goto_4

    :cond_e
    move-object v0, v2

    goto/16 :goto_3

    :cond_f
    move-object v1, v3

    goto/16 :goto_2
.end method


text:
using System;

class CofeeMashine
{
    static void Main()
    {
        System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
        customCulture.NumberFormat.NumberDecimalSeparator = ".";
        System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

        double coinFive = double.Parse(Console.ReadLine()) * 0.05;
        double coinTen = double.Parse(Console.ReadLine()) * 0.10;
        double coinTwenty = double.Parse(Console.ReadLine()) * 0.20;
        double coinFifty = double.Parse(Console.ReadLine()) * 0.50;
        double coinOne = double.Parse(Console.ReadLine()) * 1.00;
        double inputMoney = double.Parse(Console.ReadLine());
        double priceOfDrink = double.Parse(Console.ReadLine());

        double sumOfCoins = coinFive + coinTen + coinTwenty + coinFifty + coinOne;

        if (inputMoney < priceOfDrink)
        {
            Console.WriteLine("More {0:F2}", priceOfDrink-inputMoney);
        }
        else if (inputMoney >= priceOfDrink && sumOfCoins>=(inputMoney - priceOfDrink))
        {
            Console.WriteLine("Yes {0:F2}", sumOfCoins -(inputMoney - priceOfDrink));
        }
        else if (!(sumOfCoins >= (inputMoney - priceOfDrink)))
        {
            Console.WriteLine("No {0:F2}", inputMoney -(sumOfCoins + priceOfDrink));
        }

    }
}


text:
package io.dropwizard.jersey.sessions;

import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.JerseyTest;
import com.sun.jersey.test.framework.WebAppDescriptor;
import io.dropwizard.logging.LoggingFactory;
import org.junit.Test;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.NewCookie;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

public class HttpSessionProviderTest extends JerseyTest {
    static {
        LoggingFactory.bootstrap();
    }

    @Override
    protected AppDescriptor configure() {
        return new WebAppDescriptor.Builder("io.dropwizard.jersey.sessions").build();
    }

    @Test
    public void passesInHttpSessions() throws Exception {
        final ClientResponse firstResponse = resource().path("/session/")
                                                       .type(MediaType.TEXT_PLAIN)
                                                       .post(ClientResponse.class, "Mr. Peeps");
        final List<NewCookie> cookies = firstResponse.getCookies();
        firstResponse.close();

        final WebResource.Builder builder = resource().path("/session/")
                                                      .accept(MediaType.TEXT_PLAIN);

        for (NewCookie cookie : cookies) {
            builder.cookie(cookie);
        }

        final String secondResponse = builder.get(String.class);
        assertThat(secondResponse)
                .isEqualTo("Mr. Peeps");
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WX.Model.ApiRequests;
using WX.Model.ApiResponses;
using Xunit;

namespace FrameworkCoreTest
{
    public class MenuGetTest : MockPostApiBaseTest<MenuGetRequest, MenuGetResponse>
    {
        [Fact]
        public void MockMenuGetTest()
        {
            MockSetup(false);
            var response = mock_client.Object.Execute(Request);
            Assert.Equal(false, response.IsError);
            foreach (var button in response.Menu.Buttons)
            {
                Console.WriteLine(button.Name);
                foreach (var sub in button.SubButton)
                {
                    Console.WriteLine("sub : " + sub.Name);
                }
            }
        }

        protected override MenuGetRequest InitRequestObject()
        {
            return new MenuGetRequest
            {
                AccessToken = "123"
            };
        }

        protected override string GetReturnResult(bool errResult)
        {
            if (errResult)
            {
                return "{\"errcode\":40018,\"errmsg\":\"invalid button name size\"}";
            }
            return @"{""menu"":{""button"":[{""type"":""click"",""name"":""今日歌曲"",""key"":""V1001_TODAY_MUSIC"",""sub_button"":[]},{""type"":""click"",""name"":""歌手简介"",""key"":""V1001_TODAY_SINGER"",""sub_button"":[]},{""name"":""菜单"",""sub_button"":[{""type"":""view"",""name"":""搜索"",""url"":""http://www.soso.com/"",""sub_button"":[]},{""type"":""view"",""name"":""视频"",""url"":""http://v.qq.com/"",""sub_button"":[]},{""type"":""click"",""name"":""赞一下我们"",""key"":""V1001_GOOD"",""sub_button"":[]}]}]}}";
        }
    }
}


text:
echo "config pip"
mkdir -p ~/.pip/

if [ -e ~/.pip/pip.conf ];then
  mv ~/.pip/pip.conf ~/.pip/pip.conf.old
fi

echo "[global]" >> ~/.pip/pip.conf
echo "index-url = http://pypi.douban.com/simple" >> ~/.pip/pip.conf

deactivate

echo "config virtualenv"
mkdir -p ~/python_env
cd ~/python_env
if [ -e /opt/python_env ];then
  touch /opt/python_env;
else
  sudo ln -s $(pwd) /opt
fi

cd /opt/python_env
if [ -d /opt/python_env/django-scaffold ];then
  touch /opt/python_env/django-scaffold;
  source /opt/python_env/django-scaffold/bin/activate
else
  virtualenv django-scaffold && source /opt/python_env/django-scaffold/bin/activate
fi

echo "install python libs from pip"
pip install -r /opt/projects/django-scaffold/requirements/pip.txt

echo "pip install done."

echo "You might install python from github:"
echo "pip install -r /opt/projects/django-scaffold/requirements/github.txt"
echo "If install github wrong, you can clone the project first, then use 'pip install -e .'"


text:
.. _dijit/DialogUnderlay:

====================
dijit.DialogUnderlay
====================

:Authors: TODO Author
:since: 1.?

.. contents ::
    :depth: 2

Introduction
============

TODO: introduce the module

Usage
=====

.. js ::

    // TODO

Examples
========

Programmatic example
--------------------

.. code-example ::

  TODO - Here is a programmatic example

  .. js ::

  .. css ::

  .. html ::

Declarative example
-------------------

.. code-example ::

  TODO - Here is a declarative example

  .. js ::

  .. css ::

  .. html ::

See also
========


text:
import dropbox, os, re, sys
from StringIO import StringIO
from config import config
from lib.db import saveUploadedFile, updateAccountSpace

def generateAccessToken(driver, email, password):
  """Automatically generates an authentication code for the master app"""
  app_key = config['app_key']
  app_secret = config['app_secret']
  flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
  authorize_url = flow.start()

  driver.implicitly_wait(10)
  driver.get(authorize_url)

  driver.execute_script("document.getElementById('login_email').value = '%s';" % email)
  driver.execute_script("document.getElementById('login_password').value = '%s';" % password)
  driver.find_element_by_id('login_submit').click()
  driver.find_element_by_name('allow_access').click()
  auth_code = driver.find_element_by_class_name('auth-code').text
  driver.quit()

  access_token, user_id = flow.finish(auth_code)
  return access_token

def format_path(path):
  """Normalize path for use with the Dropbox API."""
  if not path:
      return path
  path = re.sub(r'/+', '/', path)
  if path == '/':
      return (u"" if isinstance(path, unicode) else "")
  else:
      return '/' + path.strip('/')

def uploadByChunk(client, file, file_size, file_name_path,
                  offset=0, last_block=None, upload_id=None,
                  chunk_size = 1024 * 1024, overwrite=True):
  """
  Loosely copied from Dropbox API.
  - Handles chunked uploading of files; allows large files & pauses in upload
  - Displays percentage of file uploaded
  """
  while offset < file_size:
    next_chunk_size = min(chunk_size, file_size - offset)
    if last_block == None:
      last_block = file.read(next_chunk_size)
    percent_uploaded = offset/float(file_size) * 100
    sys.stdout.write("\r%i%%" % percent_uploaded)
    sys.stdout.flush()
    (offset, upload_id) = client.upload_chunk(StringIO(last_block), next_chunk_size, offset, upload_id)
    last_block = None
  sys.stdout.write("\n")
  path = "/commit_chunked_upload/%s%s" % (client.session.root, format_path(file_name_path))
  params = dict(
      overwrite = bool(overwrite),
      upload_id = upload_id
  )
  url, params, headers = client.request(path, params, content_server=True)
  return client.rest_client.POST(url, params, headers)

def uploadFileToAccount(file_path, access_token):
  """Uploads a file to a dropbox account"""
  client = dropbox.client.DropboxClient(access_token)
  file = open(file_path)
  file_name = file_path.split("/")[-1]
  file_name_path = "/" + file_name
  file_size = os.stat(file_path).st_size
  uploadByChunk(client, file, file_size, file_name_path)
  file.close()

  short_link = client.share(file_name_path)['url']
  pub_link = client.share(file_name_path, short_url=False)['url']
  downloadable_link = pub_link.replace('www.dropbox.com', 'dl.dropboxusercontent.com', 1)
  updateAccountSpace(access_token, getSpaceInAccount(access_token))
  saveUploadedFile(file_name, short_link, pub_link, downloadable_link)
  print "successfully put!"
  print "pub link: " + short_link
  print "DL link: " + downloadable_link

def getSpaceInAccount(access_token):
  """Gets the available space in an account given an access_token"""
  client = dropbox.client.DropboxClient(access_token)
  account_info = client.account_info()
  quota = account_info['quota_info']['quota']
  used = account_info['quota_info']['normal'] + account_info['quota_info']['shared']
  return quota - used


text:
tr.onCompletionDisabled td {
	color: #ccc;
}

input[type=checkbox], input[type=radio] {
	vertical-align:middle;
}

div#buildList{
	padding: 1em;
}

div#buildPane {
    overflow: scroll;
}

label {
	padding: 0.5em;
	border-top: 1px black;
}

.slackNotificationRowTemplate {
	display:none;
}

.etabs { margin: 0; padding: 0 0 0 1em; }
.tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 14px; line-height: 2em; display: block; padding: 0 10px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab a.active { font-weight: bold; }
.tab-container .panel-container { background: #fff; border-top: solid #ccc 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }


text:
[![Build Status](https://travis-ci.org/techyugadi/rxmqtt.svg?branch=master)](https://travis-ci.org/techyugadi/rxmqtt)

A Java library to convert a sequence of MQTT messages into a reactive stream. Exposes methods to retrieve an RxJava Observable or Flowable from the message sequence.

Once we retrieve an Observable / Flowable, the MQTT messages can be manipulated using standard reactive stream methods, eg. map, filter, flatMap, zip, window, scan, and so on.

For usage, please browse through the sample programs in the sample directory.

There is also a unit test for validating the functionality with an Observable.


text:
| Category    |   Passed |   Total |
|-------------|----------|---------|
| All         |       70 |      76 |
| Client PIN  |       36 |      40 |
| FIDO 2.1    |        5 |       8 |
| HMAC Secret |        1 |       1 |

### Failed tests:

* Tests entries in the credential parameters list.
  * Falsely rejected cred params list with 1 good and 1 bad element.
  * A prompt was expected, but not performed. Sometimes it is just not recognized if performed too fast.
  * The failing error code is `CTAP2_ERR_UNSUPPORTED_ALGORITHM`.
* Tests is user verification set to true is accepted in MakeCredential.
  * The user verification option (true) was not accepted.
  * A prompt was expected, but not performed. Sometimes it is just not recognized if performed too fast.
  * The failing error code is `CTAP2_ERR_UNSUPPORTED_OPTION`.
* Tests if invalid UTF8 is caught in displayName.
  * UTF-8 correctness is not checked.
  * A prompt was sent unexpectedly.
  * Expected error code `CTAP2_ERR_INVALID_CBOR`, got `CTAP2_OK`.
* Tests is user verification set to true is accepted in GetAssertion.
  * The user verification option (true) was not accepted.
  * A prompt was expected, but not performed. Sometimes it is just not recognized if performed too fast.
  * The failing error code is `CTAP2_ERR_UNSUPPORTED_OPTION`.
* Tests if new PIN requirement are enforced in SetPin.
  * Accepted a PIN with padding of length 32.
  * Expected error code `CTAP2_ERR_PIN_POLICY_VIOLATION`, got `CTAP2_OK`.
* Tests if new PIN requirement are enforced in ChangePin.
  * Accepted a PIN with padding of length 32.
  * Expected error code `CTAP2_ERR_PIN_POLICY_VIOLATION`, got `CTAP2_OK`.

### Device capabilities

* HID
  * CBOR: True
  * MSG : false
  * WINK: True
* Versions
  * FIDO_2_0
  * FIDO_2_1_PRE
  * U2F_V2
* Options
  * clientPin
  * rk
  * up
  * credentialMgmtPreview
* Extensions
  * hmac-secret
  * credProtect
* All counters were strictly increasing, but not necessarily incremented by 1.

### Device information

* Serial number: A00000000017
* Manufacturer: TrustKey
* Vendor ID : 0x311f
* Product ID: 0xa7f9
* AAGUID: da776f39f6c84a89b2521d86137a46ba


text:
@interface LQTouTiaoView()

@property (nonatomic, weak) UIScrollView *scrollView;
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, strong) NSTimer *time;

@end

@implementation LQTouTiaoView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.backgroundColor = [UIColor whiteColor];

        self.titleArray = [NSMutableArray array];

        [self drawView];
    }

    return self;
}

- (void)setTitleArray:(NSMutableArray *)titleArray
{
    _titleArray = titleArray;

    for (UIView *vv in self.scrollView.subviews)
    {
        [vv removeFromSuperview];
    }

    for (int i = 0; i < self.titleArray.count; i ++)
    {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, self.scrollView.frame.size.height * i, self.scrollView.frame.size.width, self.scrollView.frame.size.height)];
        label.text = self.titleArray[i];
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = [UIColor grayColor];
        [self.scrollView addSubview:label];
    }

    [self.time invalidate];

    __weak typeof(self) weakSelf = self;
    self.time = [NSTimer scheduledTimerWithTimeInterval:2 target:weakSelf selector:@selector(lunBo) userInfo:nil repeats:YES];
    [[NSRunLoop currentRunLoop] addTimer:self.time forMode:NSRunLoopCommonModes];
}

- (void)drawView
{
    self.index = 0;

    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width , self.frame.size.height)];
    scrollView.contentSize = CGSizeMake(self.frame.size.width, self.frame.size.height * 2);
    scrollView.pagingEnabled = YES;
    scrollView.scrollEnabled = NO;
    [self addSubview:scrollView];
    self.scrollView = scrollView;
}

- (void)clickToutiao
{
    if (self.didClickToutiao) {
        self.didClickToutiao();
    }
}

- (void)lunBo
{
    if (self.index >= [self.titleArray count]-1) {
        self.index = 0;
    }else {
        self.index++;
    }

    [self.scrollView setContentOffset:CGPointMake(0, self.frame.size.height*self.index) animated:YES];
}

@end