text:
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { ActionCreators } from 'redux-undo';
import { addTodo, completeTodo, setVisibilityFilter, VisibilityFilters } from '../actions';
import AddTodo from '../components/AddTodo';
import TodoList from '../components/TodoList';
import Footer from '../components/Footer';

class App extends Component {
  render() {
    // Injected by connect() call:
    const { dispatch, visibleTodos, visibilityFilter } = this.props;
    return (
      <div>
        <AddTodo
          onAddClick={text => dispatch(addTodo(text))} />
        <TodoList
          todos={visibleTodos}
          onTodoClick={index => dispatch(completeTodo(index))} />
        <Footer
          filter={visibilityFilter}
          onFilterChange={nextFilter => dispatch(setVisibilityFilter(nextFilter))}
          onUndo={() => dispatch(ActionCreators.undo())}
          onRedo={() => dispatch(ActionCreators.redo())}
          undoDisabled={this.props.undoDisabled}
          redoDisabled={this.props.redoDisabled} />
      </div>
    );
  }
}

App.propTypes = {
  dispatch: PropTypes.func.isRequired,
  visibleTodos: PropTypes.arrayOf(PropTypes.shape({
    text: PropTypes.string.isRequired,
    completed: PropTypes.bool.isRequired
  })),
  visibilityFilter: PropTypes.oneOf([
    'SHOW_ALL',
    'SHOW_COMPLETED',
    'SHOW_ACTIVE'
  ]).isRequired,
  undoDisabled: PropTypes.bool.isRequired,
  redoDisabled: PropTypes.bool.isRequired
};

function selectTodos(todos, filter) {
  switch (filter) {
  default:
  case VisibilityFilters.SHOW_ALL:
    return todos;
  case VisibilityFilters.SHOW_COMPLETED:
    return todos.filter(todo => todo.completed);
  case VisibilityFilters.SHOW_ACTIVE:
    return todos.filter(todo => !todo.completed);
  }
}

// Which props do we want to inject, given the global state?
// Note: use https://github.com/faassen/reselect for better performance.
function select(state) {
  // don't forget to append `.present` to all undoable parts of the state
  return {
    visibleTodos: selectTodos(state.todos.present, state.visibilityFilter),
    visibilityFilter: state.visibilityFilter,
    undoDisabled: state.todos.history.past.length === 0, // disable undo button when undo is not possible (past not available)
    redoDisabled: state.todos.history.future.length === 0 // disable redo button when redo is not possible (future not available)
  };
}

// Wrap the component to inject dispatch and state into it
export default connect(select)(App);


text:
<bill session="115" type="h" number="670" updated="2017-06-22T12:57:12Z">
  <state datetime="2017-01-24">REFERRED</state>
  <status>
    <introduced datetime="2017-01-24"/>
  </status>
  <introduced datetime="2017-01-24"/>
  <titles>
    <title type="short" as="introduced">High-Skilled Integrity and Fairness Act of 2017</title>
    <title type="short" as="introduced">High-Skilled Integrity and Fairness Act of 2017</title>
    <title type="official" as="introduced">To amend the Immigration and Nationality Act to reform the H-1B visa program, and for other purposes.</title>
    <title type="display">High-Skilled Integrity and Fairness Act of 2017</title>
  </titles>
  <sponsor bioguide_id="L000397"/>
  <cosponsors/>
  <actions>
    <action datetime="2017-01-24">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-01-24" state="REFERRED">
      <text>Referred to the House Committee on the Judiciary.</text>
    </action>
    <action datetime="2017-02-08">
      <text>Referred to the Subcommittee on Immigration and Border Security.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="HSJU" name="House Judiciary" activity="Referral"/>
    <committee subcommittee="Immigration and Border Security" code="HSJU01" name="House Judiciary" activity="Referral"/>
  </committees>
  <relatedbills>
    <bill type="h" session="115" relation="unknown" number="392"/>
  </relatedbills>
  <subjects>
    <term name="Immigration"/>
    <term name="Administrative remedies"/>
    <term name="Department of Labor"/>
    <term name="Elementary and secondary education"/>
    <term name="Foreign labor"/>
    <term name="Government information and archives"/>
    <term name="Higher education"/>
    <term name="Immigration status and procedures"/>
    <term name="Small business"/>
    <term name="Visas and passports"/>
    <term name="Wages and earnings"/>
  </subjects>
  <amendments/>
  <summary date="2017-01-24T05:00:00Z" status="Introduced in House">High-Skilled Integrity and Fairness Act of 2017

This bill amends the Immigration and Nationality Act to: (1) eliminate the per-country limit for employment-based immigrant visas, and (2) increase the limit for family sponsored visas.

The bill revises: (1) the H-1B nonimmigrant visa (specialty occupation) program, including by revising the definition of "exempt H-1B nonimmigrant"; and (2) the computation of prevailing wage level for purposes of occupational classification.

The bill provides that H-1B visas will be allocated on a three-tiered wage-based system if H-1B visa petitions exceed the number of visas available for a fiscal year.

An employer may not reduce H-1B wages, except for taxes, garnishments, or under a collective bargaining agreement or where otherwise customary.

The bill reserves 20% of fiscal year H-1B visas for employers with 50 or fewer full-time employees, including parent, subsidiary, and other affiliated entities.

The bill authorizes dual intent for F-1 visa foreign students. (Dual intent is an immigration concept that allows aliens to be temporarily present in the United States with nonimmigrant status and immigrant intent.)

Students may use work experience as qualifying labor certification experience.

An amended H-1B petition shall not be required where a petitioner has a valid labor condition application for a new place of employment that has terms and conditions of employment that are the same as the previous place of employment.

The receipt of information from an employer for H-1B hiring purposes shall not be considered to be the receipt of information for purposes of determining employer compliance with labor condition requirements.</summary>
  <committee-reports/>
</bill>

redpajama_set_name: RedPajamaGithub


text:
async function waitAndMaybeReject() {
  // Wait one second
  await new Promise(r => setTimeout(r, 1000));
  // Toss a coin
  const isHeads = Boolean(Math.round(Math.random()));

  if (isHeads) return 'yay';
  throw Error('Boo!');
}

async function foo() {
  try {
    await waitAndMaybeReject();
  }
  catch (e) {
    return 'caught';
  }
}

console.log(foo())


text:
New Customer

    <form name="createCustomerForm">
<fieldset>

                First Name

                  <input type="text" data-ng-model="customerCtrl.fname" id="fname" class="form-control">

                Surname

                  <input type="text" data-ng-model="customerCtrl.sname" id="sname" class="form-control" required>

                  Suburb

                    <input type="text" data-ng-model="customerCtrl.suburb" id="suburb" class="form-control">

                  Country

                    <input type="text" data-ng-model="customerCtrl.country" id="country" class="form-control">

                Phone

                  <input type="text" data-ng-model="customerCtrl.phone" id="phone" class="form-control">

                Email

                  <input type="text" data-ng-model="customerCtrl.email" id="email" class="form-control">

                Referred

                  <input type="checkbox" data-ng-model="customerCtrl.referred" id="referred" class="form-control checkbox-left">

                Channel

                  <input type="text" data-ng-model="customerCtrl.channel" id="channel" class="form-control ">

                Industry

                  <input type="text" data-ng-model="customerCtrl.industry" id="industry" class="form-control">

        </fieldset>

            <fieldset>

            </fieldset>
          </form>

          <button class="btn btn-success" ng-click="customerCtrl.create(); ok()">Save & Close</button>
          <button class="btn btn-warning" ng-click="cancel()">Cancel</button>


text:
module Helpers
  # Reloads the specified model class.
  #
  # @param [ String | Symbol ] name Class name to reload.
  def reload_model(name)
    Object.class_eval do
      remove_const(name)
    end
    load "spec/support/models/#{name.to_s.underscore}.rb"
  end
end


text:
Pattern: Missing `core_version_requirement` in `*.info.yml` file

Issue: -

## Description

Checks if the `*.info.yml` file contains `core_version_requirement`.

## Further Reading

* [PHP_CodeSniffer - DrupalPractice.InfoFiles.CoreVersionRequirement](https://git.drupalcode.org/project/coder/-/tree/8.3.x/coder_sniffer/DrupalPractice/Sniffs/InfoFiles/CoreVersionRequirementSniff.php)


text:
<?php

namespace spec\Sylius\Behat\Context\Ui\Admin;

use Behat\Behat\Context\Context;
use PhpSpec\ObjectBehavior;
use Sylius\Behat\Context\Ui\Admin\ManagingLocalesContext;
use Sylius\Behat\Page\Admin\Locale\CreatePageInterface;
use Sylius\Behat\Page\Admin\Locale\IndexPageInterface;
use Sylius\Behat\Page\Admin\Locale\UpdatePageInterface;
use Sylius\Behat\Service\NotificationCheckerInterface;
use Sylius\Component\Locale\Model\LocaleInterface;

/**
 * @mixin ManagingLocalesContext
 *
 * @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
 */
class ManagingLocalesContextSpec extends ObjectBehavior
{
    function let(
        CreatePageInterface $createPage,
        IndexPageInterface $indexPage,
        UpdatePageInterface $updatePage,
        NotificationCheckerInterface $notificationValidator
    ) {
        $this->beConstructedWith($createPage, $indexPage, $updatePage, $notificationValidator);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Behat\Context\Ui\Admin\ManagingLocalesContext');
    }

    function it_implements_context_interface()
    {
        $this->shouldImplement(Context::class);
    }

    function it_opens_locale_creation_page(CreatePageInterface $createPage)
    {
        $createPage->open()->shouldBeCalled();

        $this->iWantToCreateNewLocale();
    }

    function it_opens_locale_update_page(UpdatePageInterface $updatePage, LocaleInterface $locale)
    {
        $locale->getId()->willReturn(1);
        $updatePage->open(['id' => 1])->shouldBeCalled();

        $this->iWantToEditThisLocale($locale);
    }

    function it_disables_locale(UpdatePageInterface $updatePage)
    {
        $updatePage->disable()->shouldBeCalled();

        $this->iDisableIt();
    }

    function it_enables_locale(UpdatePageInterface $updatePage)
    {
        $updatePage->enable()->shouldBeCalled();

        $this->iEnableIt();
    }

    function it_chooses_locale_name(CreatePageInterface $createPage)
    {
        $createPage->chooseName('Norwegian')->shouldBeCalled();

        $this->iChoose('Norwegian');
    }

    function it_creates_a_resource(CreatePageInterface $createPage)
    {
        $createPage->create()->shouldBeCalled();

        $this->iAdd();
    }

    function it_saves_changes(UpdatePageInterface $updatePage)
    {
        $updatePage->saveChanges()->shouldBeCalled();

        $this->iSaveMyChanges();
    }

    function it_asserts_that_resource_was_successfully_created(NotificationCheckerInterface $notificationValidator)
    {
        $notificationValidator->checkCreationNotification('locale')->shouldBeCalled();

        $this->iShouldBeNotifiedAboutSuccessfulCreation();
    }

    function it_asserts_that_locale_is_disabled(IndexPageInterface $indexPage, LocaleInterface $locale)
    {
        $indexPage->isLocaleDisabled($locale)->willReturn(true);

        $this->thisLocaleShouldBeDisabled($locale);
    }

    function it_asserts_that_locale_is_enabled(IndexPageInterface $indexPage, LocaleInterface $locale)
    {
        $indexPage->isLocaleEnabled($locale)->willReturn(true);

        $this->thisLocaleShouldBeEnabled($locale);
    }

    function it_throws_not_equal_exception_if_locale_has_not_proper_status(IndexPageInterface $indexPage, LocaleInterface $locale)
    {
        $indexPage->isLocaleDisabled($locale)->willReturn(false);
        $indexPage->isLocaleEnabled($locale)->willReturn(false);

        $this->shouldThrow(\InvalidArgumentException::class)->during('thisLocaleShouldBeDisabled', [$locale]);
        $this->shouldThrow(\InvalidArgumentException::class)->during('thisLocaleShouldBeEnabled', [$locale]);
    }

    function it_asserts_if_store_is_available_in_given_language(IndexPageInterface $indexPage)
    {
        $indexPage->isResourceOnPage(['name' => 'Norwegian'])->willReturn(true);

        $this->storeShouldBeAvailableInLanguage('Norwegian');
    }

    function it_throws_an_exception_if_resource_can_not_be_founded_on_page(IndexPageInterface $indexPage)
    {
        $indexPage->isResourceOnPage(['name' => 'Norwegian'])->willReturn(false);

        $this->shouldThrow(\InvalidArgumentException::class)->during('storeShouldBeAvailableInLanguage', ['Norwegian']);
    }

    function it_asserts_if_resource_can_be_choose(CreatePageInterface $createPage)
    {
        $createPage->isOptionAvailable('France')->willReturn(false);

        $this->iShouldNotBeAbleToChoose('France');
    }

    function it_throws_an_exception_if_resource_can_be_choose_but_it_should_not_be(CreatePageInterface $createPage)
    {
        $createPage->isOptionAvailable('France')->willReturn(true);

        $this->shouldThrow(\InvalidArgumentException::class)->during('iShouldNotBeAbleToChoose', ['France']);
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">

  <title>CSS Pseudo-Elements Test: active selection and image</title>

  <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
  <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-painting">
  <link rel="mismatch" href="reference/active-selection-041-notref.html">

  <meta content="should" name="flags">
  <meta name="assert" content="In this test, a filled yellow image is selected and is overlaid with an opaque blue background color. The specification states that, for replaced content, the UA should create a semi-transparent wash to coat the content. But such semi-transparent wash could use a transparency of 0.3 or 0.5 or 0.7: so, we do not know. Therefore we can not predict the rendered end result. All we can be sure of is that the image, once selected, must not be identical to its original non-selected version. This test checks precisely and only this.">

Test passes if there is a filled square which is not yellow.


text:
package tracer.differencing.core.diff;

import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;

public interface ISplitChangeVisitor {
	public void visit(IPackageFragmentRoot root);

	public void visit(IPackageFragment pkg);

	public void visit(ICompilationUnit unit, CompilationUnit unode);

	public void visit(IType type, TypeDeclaration tnode);

	public void visit(IMethod method, MethodDeclaration mnode);

	public void visit(IField field);

}


text:
#ifndef mitkBinaryImageToLabelSetImageFilter_h
#define mitkBinaryImageToLabelSetImageFilter_h

#include <mitkImageToImageFilter.h>

#include "mitkCommon.h"

#include "MitkModelFitExports.h"

namespace mitk
{
  /** \brief Converts an binary image to a LabelSetImage. The amount of labels equals the connected components.
   */
  class MITKMODELFIT_EXPORT BinaryImageToLabelSetImageFilter : public ImageToImageFilter
  {
  public:
    mitkClassMacro(BinaryImageToLabelSetImageFilter, ImageToImageFilter);
    itkFactorylessNewMacro(Self) itkCloneMacro(Self)

    void SetInput(const InputImageType* image) override;
    void SetInput(unsigned int index, const InputImageType* image) override;

    itkSetMacro(FullyConnected, bool);
    itkGetConstMacro(FullyConnected, bool);

    itkSetMacro(ForegroundValue, unsigned int);
    itkGetConstMacro(ForegroundValue, unsigned int);

    itkSetMacro(OutputIsLabelSetImage, bool);
    itkGetConstMacro(OutputIsLabelSetImage, bool);

  private:
    using Superclass::SetInput;

    BinaryImageToLabelSetImageFilter() = default;
    ~BinaryImageToLabelSetImageFilter() override = default;

    template <typename TPixel, unsigned int VImageDimension>
    void ApplyBinaryImageToLabelMapFilter(const itk::Image<TPixel, VImageDimension>* inputImage);

    void GenerateData() override;
    void VerifyInputInformation() override;
    void VerifyInputImage(const mitk::Image* inputImage);

    bool m_FullyConnected = true;
    unsigned int m_ForegroundValue = 1;
    bool m_OutputIsLabelSetImage = false;
  };
}

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <color name="rectColor">#0398FC</color>
  <color name="rectSelectedColor">#FC7303</color>
</resources>


text:
export const DOMAIN = '';
const CREDENTIALS = (process.env.ORIGIN) ? 'include' : 'same-origin';

export const listArticle = async() => {
  let url = DOMAIN + '/api/article_list';

  try {
    var result = await fetch(url, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-type': 'application/json'
      },
      credentials: CREDENTIALS
    })
  } catch(e) {

  }

  if (result) {
    return result.json();
  } else {
    return {
      code: '-2',
      message: '未知错误'
    }
  }
}

export const listPageArticle = async(page, eachPageArticles) => {
  let url = DOMAIN + '/api/article_list/init';

  try {
    var result = await fetch(url, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-type': 'application/json'
      },
      body: JSON.stringify({
        page,
        eachPageArticles
      }),
      credentials: CREDENTIALS
    })
  } catch(e) {

  }

  if (result) {
    return result.json();
  } else {
    return {
      code: '-2',
      message: '未知错误'
    }
  }
}

export const deleteArticle = async (articleId) => {
  let url = DOMAIN + `/api/article_delete/${articleId}`;

  try {
    var result = await fetch(url, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-type': 'application/json'
      },
      credentials: CREDENTIALS
    })
  } catch (e) {
    console.log(e);
  }

  if (result) {
    return result.json();
  } else {
    return {
      code: '-2',
      message: '未知错误'
    }
  }
}


text:
package com.aspose.cells.examples.articles;

import com.aspose.cells.Cell;
import com.aspose.cells.CellValueType;
import com.aspose.cells.LightCellsDataHandler;
import com.aspose.cells.Row;
import com.aspose.cells.Worksheet;

public class LightCellsDataHandlerVisitCells implements LightCellsDataHandler {
	public int cellCount;
	public int formulaCount;
	public int stringCount;

	public LightCellsDataHandlerVisitCells() {
		this.cellCount = 0;
		this.formulaCount = 0;
		this.stringCount = 0;
	}

	public int cellCount() {
		return cellCount;
	}

	public int formulaCount() {
		return formulaCount;
	}

	public int stringCount() {
		return stringCount;
	}

	public boolean startSheet(Worksheet sheet) {
		System.out.println("Processing sheet[" + sheet.getName() + "]");
		return true;
	}

	public boolean startRow(int rowIndex) {
		return true;
	}

	public boolean processRow(Row row) {
		return true;
	}

	public boolean startCell(int column) {
		return true;
	}

	public boolean processCell(Cell cell) {
		this.cellCount = this.cellCount + 1;
		if (cell.isFormula()) {
			this.formulaCount = this.formulaCount + 1;
		} else if (cell.getType() == CellValueType.IS_STRING) {
			this.stringCount = this.stringCount + 1;
		}
		return false;
	}
}


text:
<?php
namespace ERD\SearchBundle\Search\Tests;

use ERD\SearchBundle\Search\LuceneSearch;
/**
 * Test class for LuceneSearch.
 * Generated by PHPUnit on 2012-06-23 at 19:12:51.
 */
class LuceneSearchTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var LuceneSearch
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        //$this->object = new LuceneSearch;
    }

    /**
     * @covers ERD\SearchBundle\Search\LuceneSearch::find
     * @todo Implement testFind().
     */
    public function testFind()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
                'This test has not been implemented yet.'
        );
    }

    /**
     * @covers ERD\SearchBundle\Search\LuceneSearch::emptyIndex
     * @todo Implement testEmptyIndex().
     */
    public function testEmptyIndex()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
                'This test has not been implemented yet.'
        );
    }

}
?>


text:
package org.semispace;

import java.util.Map;

/**
 * Holds a reference to the listener, including how long it shall live.
 */
public class ListenerHolder {
    private long liveUntil;
    private long id;
    private SemiEventListener listener;
    private Map<String, String> searchMap;

    public ListenerHolder(long id, SemiEventListener listener, long liveUntil, Map<String, String> map) {
        this.listener = listener;
        this.liveUntil = liveUntil;
        this.searchMap = map;
        this.id=id;
    }

    public SemiEventListener getListener() {
        return this.listener;
    }

    public long getLiveUntil() {
        return this.liveUntil;
    }

    public Map<String, String> getSearchMap() {
        return this.searchMap;
    }

    public long getId() {
        return this.id;
    }

    protected void setLiveUntil(long liveUntil) {
        this.liveUntil = liveUntil;
    }

}


text:
use crate::{account_address::AccountAddress, event::EventHandle};
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct VestingAdminStore {
    pub vesting_contracts: Vec<AccountAddress>,
    nonce: u64,
    create_events: EventHandle,
}


text:
#ifndef LIBGEOTIFF_GEOTIFFIO_H_
#define LIBGEOTIFF_GEOTIFFIO_H_

#include "geotiff.h"  /* public key interface */
#include "geovalues.h" /* key code definitions */

#endif /* LIBGEOTIFF_GEOTIFFIO_H_ */


text:
void rccInit(void);
void delayInit(uint8_t SYSCLK);
void delay_ms(uint16_t nms);
void delay_us(uint32_t nus);

#endif


text:
namespace kudu {
namespace clock {

Status MockNtp::WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) {
  std::lock_guard<simple_spinlock> lock(lock_);
  VLOG(1) << "Current clock time: " << mock_clock_time_usec_
          << " error: " << mock_clock_max_error_usec_;
  *now_usec = mock_clock_time_usec_;
  *error_usec = mock_clock_max_error_usec_;
  return Status::OK();
}

void MockNtp::SetMockClockWallTimeForTests(uint64_t now_usec) {
  std::lock_guard<simple_spinlock> lock(lock_);
  VLOG(1) << "Updating to time: " << now_usec;
  CHECK_GE(now_usec, mock_clock_time_usec_);
  mock_clock_time_usec_ = now_usec;
}

void MockNtp::SetMockMaxClockErrorForTests(uint64_t max_error_usec) {
  std::lock_guard<simple_spinlock> lock(lock_);
  VLOG(1) << "Updating to error: " << max_error_usec;
  mock_clock_max_error_usec_ = max_error_usec;
}

} // namespace clock
} // namespace kudu


text:
'use strict';

const fse = require('fs-extra');
const path = require('path');
const ejs = require('ejs');
const utils = require('../cli/utils');
const pkg = require('../package.json');
const { Storage } = require('@google-cloud/storage');
const storage = new Storage();
const buildPath = 'build';
const cordova = utils.cordova(buildPath);

const BUILD_NUMBER = parseInt(process.env.GITHUB_RUN_NUMBER || '1') + 2530;
const BRANCH = process.env.GITHUB_REF && process.env.GITHUB_REF.replace('refs/heads/', '');

async function run() {
  const config = ejs.render(fse.readFileSync('config.xml.template', 'utf-8'), {
    widget: {
      id: 'com.coinspace.app',
      name: 'Coin Wallet',
      version: pkg.version,
      androidVersionCode: BUILD_NUMBER,
    },
  });
  fse.writeFileSync(path.resolve(buildPath, 'config.xml'), config);

  /* eslint-disable max-len */
  cordova('platform add android@10.1.2 --save');
  cordova('plugin add cordova-plugin-androidx-adapter@1.1.3 --save');
  cordova('plugin add cordova-custom-config@5.1.0 --save');
  cordova('plugin add cordova-plugin-geolocation@4.0.2 --save');
  cordova('plugin add phonegap-plugin-barcodescanner@8.1.0 --save --variable ANDROID_SUPPORT_V4_VERSION=28.0.0');
  cordova('plugin add cordova-plugin-dialogs@2.0.2 --save');
  cordova('plugin add cordova-plugin-inappbrowser@4.0.0 --save');
  cordova('plugin add cordova-plugin-x-socialsharing@5.6.8 --save');
  cordova('plugin add cordova-plugin-fingerprint-aio@5.0.1 --save');
  cordova('plugin add cordova-plugin-customurlscheme@5.0.1 --save --variable URL_SCHEME=coinspace');
  cordova('plugin add https://github.com/CoinSpace/cordova-plugin-zendesk#4bf28de7fcd6759450f5fd56f2ec28677bc882da --save');
  cordova('plugin add cordova-plugin-splashscreen@5.0.4 --save');
  cordova('plugin add cordova-plugin-safariviewcontroller@1.6.0 --save');
  cordova('plugin add cordova-plugin-inapp-review@1.1.0 --save --variable PLAY_CORE_VERSION=1.8.0');
  cordova('plugin add cordova-plugin-velda-devicefeedback@0.0.2 --save');

  if (process.env.RELEASE) {
    cordova('build android --release -- --packageType=apk');
    utils.shell(
      'zipalign -f 4 platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk \
      ../deploy/coinspace-release.apk',
      { cwd: buildPath }
    );
    utils.shell(
      'apksigner sign --ks-pass=pass:coinspace -ks ../release.keystore \
      ../deploy/coinspace-release.apk',
      { cwd: buildPath }
    );
    const destination = `${pkg.version}-${BRANCH || 'local'}/${pkg.name}-${process.env.BUILD_PLATFORM}-${pkg.version}.apk`;
    await storage.bucket(process.env.GOOGLE_CLOUD_BUCKET).upload('deploy/coinspace-release.apk', { destination });
  } else {
    cordova('build android');
  }
}

process.on('unhandledRejection', (err) => {
  throw err;
});

run();


text:
package com.hfp.youtie.adapter;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobPointer;
import cn.bmob.v3.datatype.BmobRelation;
import cn.bmob.v3.listener.DeleteListener;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.UpdateListener;

import com.bmob.lostfound.Mainac;
import com.easemob.chatuidemo.activity.CircularImage;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener;
import com.hfp.youtie.MyApplication;
import com.hfp.youtie.R;
import com.hfp.youtie.db.DatabaseUtil;
import com.hfp.youtie.entity.QiangYu;
import com.hfp.youtie.entity.User;
import com.hfp.youtie.sns.TencentShare;
import com.hfp.youtie.sns.TencentShareEntity;
import com.hfp.youtie.ui.CommentActivity;
import com.hfp.youtie.ui.MainActivity;
import com.hfp.youtie.ui.PersonalActivity;
import com.hfp.youtie.ui.RegisterAndLoginActivity;
import com.hfp.youtie.utils.ActivityUtil;
import com.hfp.youtie.utils.Constant;
import com.hfp.youtie.utils.LogUtils;

/**
 * @author kingofglory
 *         email: kingofglory@yeah.net
 *         blog:  http:www.google.com
 * @date 2014-2-24
 * TODO
 */

public class AIContentAdapter extends BaseContentAdapter<QiangYu>{

	public static final String TAG = "AIContentAdapter";
	public static final int SAVE_FAVOURITE = 2;

	public AIContentAdapter(Context context, List<QiangYu> list) {
		super(context, list);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getConvertView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
	    final ViewHolder viewHolder;
		if(convertView == null){
			viewHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.ai_item, null);
			viewHolder.userName = (TextView)convertView.findViewById(R.id.user_name);
			viewHolder.userLogo = (CircularImage)convertView.findViewById(R.id.user_logo);
			viewHolder.favMark = (ImageView)convertView.findViewById(R.id.item_action_fav);
			viewHolder.contentText = (TextView)convertView.findViewById(R.id.content_text);
			viewHolder.contentImage = (ImageView)convertView.findViewById(R.id.content_image);
			viewHolder.love = (TextView)convertView.findViewById(R.id.item_action_love);
			viewHolder.hate = (TextView)convertView.findViewById(R.id.item_action_hate);
			viewHolder.share = (TextView)convertView.findViewById(R.id.item_action_share);
			viewHolder.comment = (TextView)convertView.findViewById(R.id.item_action_comment);

			viewHolder.tv_time= (TextView)convertView.findViewById(R.id.tv_time);//////////////////////
			viewHolder.delete = (TextView)convertView.findViewById(R.id.delete);/////////////

			convertView.setTag(viewHolder);
		}else{
			viewHolder = (ViewHolder)convertView.getTag();
		}
		final QiangYu entity = dataList.get(position);
		LogUtils.i("user",entity.toString());
		User user = entity.getAuthor();

		if(user == null){
			LogUtils.i("user","USER IS NULL");
		}
		if(user.getAvatar()==null){
			LogUtils.i("user","USER avatar IS NULL");
		}
		String avatarUrl = null;
		if(user.getAvatar()!=null){
			avatarUrl = user.getAvatar();
		}
		ImageLoader.getInstance()
		.displayImage(avatarUrl, viewHolder.userLogo,
				MyApplication.getInstance().getOptions(R.drawable.user_icon_default_main),
				new SimpleImageLoadingListener(){

					@Override
					public void onLoadingComplete(String imageUri, View view,
							Bitmap loadedImage) {
						// TODO Auto-generated method stub
						super.onLoadingComplete(imageUri, view, loadedImage);
					}

		});
			if(MyApplication.getInstance().getCurrentUser()!=null){
				// TODO Auto-generated method stub
				MyApplication.getInstance().setCurrentQiangYu(entity);
				User cUser = BmobUser.getCurrentUser(mContext, User.class);
				String id=MyApplication.getInstance().getCurrentUser().getObjectId();
				Log.i("bmob",id);
				String idd=entity.getAuthor().getObjectId();
			if(id.equals(idd)){///////////////////////////////String字符串的比较
				viewHolder.delete.setVisibility(View.VISIBLE);
			}else{
				viewHolder.delete.setVisibility(View.GONE);
			}
			}else{
				viewHolder.delete.setVisibility(View.GONE);
			}
		///////////////////////////////////
			viewHolder.delete.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					MyApplication.getInstance().setCurrentQiangYu(entity);
					User cUser = BmobUser.getCurrentUser(mContext, User.class);
					String id=MyApplication.getInstance().getCurrentUser().getObjectId();
					Log.i("bmob",id);
					String idd=entity.getAuthor().getObjectId();
				if(id.equals(idd)){///////////////////////////////String字符串的比较
					entity.setObjectId(entity.getObjectId());
					entity.delete(mContext, new DeleteListener() {

						@Override
						public void onSuccess() {
							// TODO Auto-generated method stub
							//dataList.remove(pos);
							Log.i("bmob","删除成功");
							Log.i("bmob",entity.getAuthor().getObjectId());
							Toast.makeText(mContext, "删除成功~", Toast.LENGTH_SHORT).show();
						}

						@Override
						public void onFailure(int code, String arg0) {
							// TODO Auto-generated method stub
							Log.i("bmob","删除失败:");
							Toast.makeText(mContext, "删除失败:不是原作者或请检查网络~", Toast.LENGTH_SHORT).show();
						}
					});
				}
				}
			});///////////////////////////////////

		viewHolder.userLogo.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(MyApplication.getInstance().getCurrentUser()==null){
					ActivityUtil.show(mContext, "请先登录。");
					Intent intent = new Intent();
					intent.setClass(mContext, RegisterAndLoginActivity.class);
					MyApplication.getInstance().getTopActivity().startActivity(intent);
					return;
				}
				MyApplication.getInstance().setCurrentQiangYu(entity);
//				User currentUser = BmobUser.getCurrentUser(mContext,User.class);
//				if(currentUser != null){//已登录
					Intent intent = new Intent();
					intent.setClass(MyApplication.getInstance().getTopActivity(), PersonalActivity.class);
					mContext.startActivity(intent);
//				}else{//未登录
//					ActivityUtil.show(mContext, "请先登录。");
//					Intent intent = new Intent();
//					intent.setClass(MyApplication.getInstance().getTopActivity(), RegisterAndLoginActivity.class);
//					MyApplication.getInstance().getTopActivity().startActivityForResult(intent, Constant.GO_SETTINGS);
//				}
			}
		});

		viewHolder.tv_time.setText(entity.getCreatedAt());/////////////////
		viewHolder.userName.setText(entity.getAuthor().getUsername());
		viewHolder.contentText.setText(entity.getContent());
		if(null == entity.getContentfigureurl()){
			viewHolder.contentImage.setVisibility(View.GONE);
		}else{
			viewHolder.contentImage.setVisibility(View.VISIBLE);
			ImageLoader.getInstance()
			.displayImage(entity.getContentfigureurl().getFileUrl(mContext)==null?"":entity.getContentfigureurl().getFileUrl(mContext), viewHolder.contentImage,
					MyApplication.getInstance().getOptions(R.drawable.bg_pic_loading),////////////////////////////////mContext
					new SimpleImageLoadingListener(){

						@Override
						public void onLoadingComplete(String imageUri, View view,
								Bitmap loadedImage) {
							// TODO Auto-generated method stub
							super.onLoadingComplete(imageUri, view, loadedImage);
							 float[] cons=ActivityUtil.getBitmapConfiguration(loadedImage, viewHolder.contentImage, 1.0f);
	                         RelativeLayout.LayoutParams layoutParams=
	                             new RelativeLayout.LayoutParams((int)cons[0], (int)cons[1]);
	                         layoutParams.addRule(RelativeLayout.BELOW,R.id.content_text);
	                         viewHolder.contentImage.setLayoutParams(layoutParams);
						}

			});
		}
		viewHolder.love.setText(entity.getLove()+"");
		LogUtils.i("love",entity.getMyLove()+"..");
		if(entity.getMyLove()){
			viewHolder.love.setTextColor(Color.parseColor("#D95555"));
		}else{
			viewHolder.love.setTextColor(Color.parseColor("#000000"));
		}
		viewHolder.hate.setText(entity.getHate()+"");
		viewHolder.love.setOnClickListener(new OnClickListener() {
			boolean oldFav = entity.getMyFav();
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(MyApplication.getInstance().getCurrentUser()==null){
					ActivityUtil.show(mContext, "请先登录。");
					Intent intent = new Intent();
					intent.setClass(mContext, RegisterAndLoginActivity.class);
					MyApplication.getInstance().getTopActivity().startActivity(intent);
					return;
				}
				if(entity.getMyLove()){
					ActivityUtil.show(mContext, "您已赞过啦");
					return;
				}

				if(DatabaseUtil.getInstance(mContext).isLoved(entity)){
					ActivityUtil.show(mContext, "您已赞过啦");
					entity.setMyLove(true);
					entity.setLove(entity.getLove()+1);
					viewHolder.love.setTextColor(Color.parseColor("#D95555"));
					viewHolder.love.setText(entity.getLove()+"");
					return;
				}

				entity.setLove(entity.getLove()+1);
				viewHolder.love.setTextColor(Color.parseColor("#D95555"));
				viewHolder.love.setText(entity.getLove()+"");

				entity.increment("love",1);
				if(entity.getMyFav()){
					entity.setMyFav(false);
				}
				entity.update(mContext, new UpdateListener() {

					@Override
					public void onSuccess() {
						// TODO Auto-generated method stub
						entity.setMyLove(true);
						entity.setMyFav(oldFav);
						DatabaseUtil.getInstance(mContext).insertFav(entity);
//						DatabaseUtil.getInstance(mContext).queryFav();
						LogUtils.i(TAG, "点赞成功~");
					}

					@Override
					public void onFailure(int arg0, String arg1) {
						// TODO Auto-generated method stub
						entity.setMyLove(true);
						entity.setMyFav(oldFav);
					}
				});
			}
		});
		viewHolder.hate.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				entity.setHate(entity.getHate()+1);
				viewHolder.hate.setText(entity.getHate()+"");
				entity.increment("hate",1);
				entity.update(mContext, new UpdateListener() {

					@Override
					public void onSuccess() {
						// TODO Auto-generated method stub
						ActivityUtil.show(mContext, "点踩成功~");
					}

					@Override
					public void onFailure(int arg0, String arg1) {
						// TODO Auto-generated method stub

					}
				});
			}
		});
		viewHolder.share.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//share to sociaty
				ActivityUtil.show(mContext, "分享给好友看哦~");
				final TencentShare tencentShare=new TencentShare(MyApplication.getInstance().getTopActivity(), getQQShareEntity(entity));
				tencentShare.shareToQQ();
			}
		});
		viewHolder.comment.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//评论
//				MyApplication.getInstance().setCurrentQiangYu(entity);
				if(MyApplication.getInstance().getCurrentUser()==null){
					ActivityUtil.show(mContext, "请先登录。");
					Intent intent = new Intent();
					intent.setClass(mContext, RegisterAndLoginActivity.class);
					MyApplication.getInstance().getTopActivity().startActivity(intent);
					return;
				}
				Intent intent = new Intent();
				intent.setClass(MyApplication.getInstance().getTopActivity(), CommentActivity.class);
				intent.putExtra("data", entity);
				mContext.startActivity(intent);
			}
		});

		if(entity.getMyFav()){
			viewHolder.favMark.setImageResource(R.drawable.shoucang);
		}else{
			viewHolder.favMark.setImageResource(R.drawable.shoucang);
		}
		viewHolder.favMark.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//收藏
				ActivityUtil.show(mContext, "收藏");
				onClickFav(v,entity);

			}
		});
		return convertView;
	}

	 private TencentShareEntity getQQShareEntity(QiangYu qy) {
	        String title= "这里好多美丽的风景";
	        String comment="来领略最美的风景吧";
	        String img= null;
	        if(qy.getContentfigureurl()!=null){
	        	img = qy.getContentfigureurl().getFileUrl(mContext);
	        }else{
	        	img = "http://www.codenow.cn/appwebsite/website/yyquan/uploads/53af6851d5d72.png";
	        }
	        String summary=qy.getContent();

	        String targetUrl="http://yuanquan.bmob.cn";
	        TencentShareEntity entity=new TencentShareEntity(title, img, targetUrl, summary, comment);
	        return entity;
	    }

	public static class ViewHolder{
		public CircularImage userLogo;
		public TextView userName;
		public TextView contentText;
		public ImageView contentImage;

		public ImageView favMark;
		public TextView love;
		public TextView hate;
		public TextView share;
		public TextView comment;

		public TextView tv_time;//////////////////////////////////////////////////////
		public TextView delete;////////////////////
	}

	private void onClickFav(View v,final QiangYu qiangYu) {
		// TODO Auto-generated method stub
		User user = BmobUser.getCurrentUser(mContext, User.class);
		if(user != null && user.getSessionToken()!=null){
			BmobRelation favRelaton = new BmobRelation();

			qiangYu.setMyFav(!qiangYu.getMyFav());
			if(qiangYu.getMyFav()){
				((ImageView)v).setImageResource(R.drawable.shoucang);
				favRelaton.add(qiangYu);
				user.setFavorite(favRelaton);
				ActivityUtil.show(mContext, "收藏成功。");
				user.update(mContext, new UpdateListener() {

					@Override
					public void onSuccess() {
						// TODO Auto-generated method stub
						DatabaseUtil.getInstance(mContext).insertFav(qiangYu);
						LogUtils.i(TAG, "收藏成功。");
						//try get fav to see if fav success
//						getMyFavourite();
					}

					@Override
					public void onFailure(int arg0, String arg1) {
						// TODO Auto-generated method stub
						LogUtils.i(TAG, "收藏失败。请检查网络~");
						ActivityUtil.show(mContext, "收藏失败。请检查网络~"+arg0);
					}
				});

			}else{
				((ImageView)v).setImageResource(R.drawable.shoucang);
				favRelaton.remove(qiangYu);
				user.setFavorite(favRelaton);
				ActivityUtil.show(mContext, "取消收藏。");
				user.update(mContext, new UpdateListener() {

					@Override
					public void onSuccess() {
						// TODO Auto-generated method stub
						DatabaseUtil.getInstance(mContext).deleteFav(qiangYu);
						LogUtils.i(TAG, "取消收藏。");
						//try get fav to see if fav success
//						getMyFavourite();
					}

					@Override
					public void onFailure(int arg0, String arg1) {
						// TODO Auto-generated method stub
						LogUtils.i(TAG, "取消收藏失败。请检查网络~");
						ActivityUtil.show(mContext, "取消收藏失败。请检查网络~"+arg0);
					}
				});
			}

		}else{
			//前往登录注册界面
			ActivityUtil.show(mContext, "收藏前请先登录。");
			Intent intent = new Intent();
			intent.setClass(mContext, RegisterAndLoginActivity.class);
			MyApplication.getInstance().getTopActivity().startActivityForResult(intent, SAVE_FAVOURITE);
		}
	}

	private void getMyFavourite(){
		User user = BmobUser.getCurrentUser(mContext, User.class);
		if(user!=null){
			BmobQuery<QiangYu> query = new BmobQuery<QiangYu>();
			query.addWhereRelatedTo("favorite", new BmobPointer(user));
			query.include("user");
			query.order("createdAt");
			query.setLimit(Constant.NUMBERS_PER_PAGE);
			query.findObjects(mContext, new FindListener<QiangYu>() {

				@Override
				public void onSuccess(List<QiangYu> data) {
					// TODO Auto-generated method stub
					LogUtils.i(TAG,"get fav success!"+data.size());
					ActivityUtil.show(mContext, "fav size:"+data.size());
				}

				@Override
				public void onError(int arg0, String arg1) {
					// TODO Auto-generated method stub
					ActivityUtil.show(mContext, "获取收藏失败。请检查网络~");
				}
			});
		}else{
			//前往登录注册界面
			ActivityUtil.show(mContext, "获取收藏前请先登录。");
			Intent intent = new Intent();
			intent.setClass(mContext, RegisterAndLoginActivity.class);
			MyApplication.getInstance().getTopActivity().startActivityForResult(intent,Constant.GET_FAVOURITE);
		}
	}
}


text:
using MonsterApp.DataClient.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace MonsterApp.DataClient
{
  /// <summary>
  ///
  ///
  /// </summary>
  [ServiceContract]
  public interface IMonsterService
  {

    [OperationContract()]
    List<GenderDAO> GetGenders();

    [OperationContract()]
    List<MonsterTypeDAO> GetMonsterTypes();

    [OperationContract()]
    [WebInvoke]
    List<TitleDAO> GetTitles();

  }
}


text:
/**
 * @file TreemapChart
 */
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import _ from 'lodash';
import Surface from '../container/Surface';
import Layer from '../container/Layer';
import Tooltip from '../component/Tooltip';
import Rectangle from '../shape/Rectangle';
import pureRender, { shallowEqual } from '../util/PureRender';
import { PRESENTATION_ATTRIBUTES, getPresentationAttributes, EVENT_ATTRIBUTES,
  filterSvgElements, validateWidthHeight, findChildByType } from '../util/ReactUtils';
import { getValueByDataKey } from '../util/ChartUtils';

const defaultCoordinateOfTooltip = { x: 0, y: 0 };

const interpolationGenerator = (a, b) => {
  const ka = +a;
  const kb = b - ka;
  return t => ka + kb * t;
};
const centerY = node => (node.y + node.dy / 2);
const getValue = entry => ((entry && entry.value) || 0);
const getSumOfIds = (links, ids) => (
  ids.reduce((result, id) => (result + getValue(links[id])), 0)
);
const getSumWithWeightedSource = (tree, links, ids) => (
  ids.reduce((result, id) => {
    const link = links[id];
    const sourceNode = tree[link.source];

    return result + centerY(sourceNode) * getValue(links[id]);
  }, 0)
);
const getSumWithWeightedTarget = (tree, links, ids) => (
  ids.reduce((result, id) => {
    const link = links[id];
    const targetNode = tree[link.target];

    return result + centerY(targetNode) * getValue(links[id]);
  }, 0)
);
const ascendingY = (a, b) => (a.y - b.y);

const searchTargetsAndSources = (links, id) => {
  const sourceNodes = [];
  const sourceLinks = [];
  const targetNodes = [];
  const targetLinks = [];

  for (let i = 0, len = links.length; i < len; i++) {
    const link = links[i];

    if (link.source === id) {
      targetNodes.push(link.target);
      targetLinks.push(i);
    }

    if (link.target === id) {
      sourceNodes.push(link.source);
      sourceLinks.push(i);
    }
  }

  return { sourceNodes, sourceLinks, targetLinks, targetNodes };
};

const updateDepthOfTargets = (tree, curNode) => {
  const targetNodes = curNode.targetNodes;

  for (let i = 0, len = targetNodes.length; i < len; i++) {
    const target = tree[targetNodes[i]];

    if (target) {
      target.depth = Math.max(curNode.depth + 1, target.depth);

      updateDepthOfTargets(tree, target);
    }
  }
};

const getNodesTree = ({ nodes, links }, width, nodeWidth) => {
  const tree = nodes.map((entry, index) => {
    const result = searchTargetsAndSources(links, index);

    return {
      ...entry,
      ...result,
      value: Math.max(
        getSumOfIds(links, result.sourceLinks),
        getSumOfIds(links, result.targetLinks)
      ),
      depth: 0,
    };
  });

  for (let i = 0, len = tree.length; i < len; i++) {
    const node = tree[i];

    if (!node.sourceNodes.length) {
      updateDepthOfTargets(tree, node);
    }
  }
  const maxDepth = _.maxBy(tree, entry => entry.depth).depth;

  if (maxDepth >= 1) {
    const childWidth = (width - nodeWidth) / maxDepth;
    for (let i = 0, len = tree.length; i < len; i++) {
      const node = tree[i];

      if (!node.targetNodes.length) {
        node.depth = maxDepth;
      }
      node.x = node.depth * childWidth;
      node.dx = nodeWidth;
    }
  }

  return { tree, maxDepth };
};

const getDepthTree = (tree) => {
  const result = [];

  for (let i = 0, len = tree.length; i < len; i++) {
    const node = tree[i];

    if (!result[node.depth]) {
      result[node.depth] = [];
    }

    result[node.depth].push(node);
  }

  return result;
};

const updateYOfTree = (depthTree, height, nodePadding, links) => {
  const yRatio = _.min(depthTree.map(nodes => (
    (height - (nodes.length - 1) * nodePadding) / _.sumBy(nodes, getValue)
  )));

  for (let d = 0, maxDepth = depthTree.length; d < maxDepth; d++) {
    for (let i = 0, len = depthTree[d].length; i < len; i++) {
      const node = depthTree[d][i];

      node.y = i;
      node.dy = node.value * yRatio;
    }
  }

  return links.map(link => ({ ...link, dy: getValue(link) * yRatio }));
};

const resolveCollisions = (depthTree, height, nodePadding) => {
  for (let i = 0, len = depthTree.length; i < len; i++) {
    const nodes = depthTree[i];
    const n = nodes.length;

    // Sort by the value of y
    nodes.sort(ascendingY);

    let y0 = 0;
    for (let j = 0; j < n; j++) {
      const node = nodes[j];
      const dy = y0 - node.y;

      if (dy > 0) {
        node.y += dy;
      }

      y0 = node.y + node.dy + nodePadding;
    }

    y0 = height + nodePadding;
    for (let j = n - 1; j >= 0; j--) {
      const node = nodes[j];
      const dy = node.y + node.dy + nodePadding - y0;

      if (dy > 0) {
        node.y -= dy;
        y0 = node.y;
      } else {
        break;
      }
    }
  }
};

const relaxLeftToRight = (tree, depthTree, links, alpha) => {
  for (let i = 0, maxDepth = depthTree.length; i < maxDepth; i++) {
    const nodes = depthTree[i];

    for (let j = 0, len = nodes.length; j < len; j++) {
      const node = nodes[j];

      if (node.sourceLinks.length) {
        const sourceSum = getSumOfIds(links, node.sourceLinks);
        const weightedSum = getSumWithWeightedSource(tree, links, node.sourceLinks);
        const y = weightedSum / sourceSum;

        node.y += (y - centerY(node)) * alpha;
      }
    }
  }
};
const relaxRightToLeft = (tree, depthTree, links, alpha) => {
  for (let i = depthTree.length - 1; i >= 0; i--) {
    const nodes = depthTree[i];

    for (let j = 0, len = nodes.length; j < len; j++) {
      const node = nodes[j];

      if (node.targetLinks.length) {
        const targetSum = getSumOfIds(links, node.targetLinks);
        const weightedSum = getSumWithWeightedTarget(tree, links, node.targetLinks);
        const y = weightedSum / targetSum;

        node.y += (y - centerY(node)) * alpha;
      }
    }
  }
};
const updateYOfLinks = (tree, links) => {
  for (let i = 0, len = tree.length; i < len; i++) {
    const node = tree[i];
    let sy = 0;
    let ty = 0;

    node.targetLinks.sort((a, b) => (tree[links[a].target].y - tree[links[b].target].y));
    node.sourceLinks.sort((a, b) => (tree[links[a].source].y - tree[links[b].source].y));

    for (let j = 0, tLen = node.targetLinks.length; j < tLen; j++) {
      const link = links[node.targetLinks[j]];

      if (link) {
        link.sy = sy;
        sy += link.dy;
      }
    }

    for (let j = 0, sLen = node.sourceLinks.length; j < sLen; j++) {
      const link = links[node.sourceLinks[j]];

      if (link) {
        link.ty = ty;
        ty += link.dy;
      }
    }
  }
};

const computeData = ({ data, width, height, iterations, nodeWidth, nodePadding }) => {
  const { links } = data;
  const { tree } = getNodesTree(data, width, nodeWidth);
  const depthTree = getDepthTree(tree);
  const newLinks = updateYOfTree(depthTree, height, nodePadding, links);

  resolveCollisions(depthTree, height, nodePadding);

  let alpha = 1;
  for (let i = 1; i <= iterations; i++) {
    relaxRightToLeft(tree, depthTree, newLinks, alpha *= 0.99);

    resolveCollisions(depthTree, height, nodePadding);

    relaxLeftToRight(tree, depthTree, newLinks, alpha);

    resolveCollisions(depthTree, height, nodePadding);
  }

  updateYOfLinks(tree, newLinks);

  return { nodes: tree, links: newLinks };
};

const getCoordinateOfTooltip = (el, type) => {
  if (type === 'node') {
    return { x: el.x + el.width / 2, y: el.y + el.height / 2 };
  }

  return {
    x: (el.sourceX + el.targetX) / 2,
    y: (el.sourceY + el.targetY) / 2,
  };
};

const getPayloadOfTooltip = (el, type, nameKey) => {
  const { payload } = el;
  if (type === 'node') {
    return [{
      payload: el,
      name: getValueByDataKey(payload, nameKey, ''),
      value: getValueByDataKey(payload, 'value'),
    }];
  }
  if (payload.source && payload.target) {
    const sourceName = getValueByDataKey(payload.source, nameKey, '');
    const targetName = getValueByDataKey(payload.target, nameKey, '');

    return [{
      payload: el,
      name: `${sourceName} - ${targetName}`,
      value: getValueByDataKey(payload, 'value'),
    }];
  }

  return [];
};

@pureRender
class Sankey extends Component {
  static displayName = 'Sankey';

  static propTypes = {
    ...PRESENTATION_ATTRIBUTES,
    ...EVENT_ATTRIBUTES,

    nameKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func]),
    dataKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func]),
    width: PropTypes.number,
    height: PropTypes.number,
    data: PropTypes.shape({
      nodes: PropTypes.array,
      links: PropTypes.arrayOf(PropTypes.shape({
        target: PropTypes.number,
        source: PropTypes.number,
        value: PropTypes.number,
      })),
    }),

    nodePadding: PropTypes.number,
    nodeWidth: PropTypes.number,
    linkCurvature: PropTypes.number,
    iterations: PropTypes.number,

    node: PropTypes.oneOfType([PropTypes.object, PropTypes.element, PropTypes.func]),
    link: PropTypes.oneOfType([PropTypes.object, PropTypes.element, PropTypes.func]),

    style: PropTypes.object,
    className: PropTypes.string,
    children: PropTypes.oneOfType([
      PropTypes.arrayOf(PropTypes.node),
      PropTypes.node,
    ]),
    margin: PropTypes.shape({
      top: PropTypes.number,
      right: PropTypes.number,
      bottom: PropTypes.number,
      left: PropTypes.number,
    }),
  };

  static defaultProps = {
    nodePadding: 10,
    nodeWidth: 10,
    nameKey: 'name',
    dataKey: 'value',
    linkCurvature: 0.5,
    iterations: 32,
    margin: { top: 5, right: 5, bottom: 5, left: 5 },
  };

  constructor(props) {
    super(props);

    this.state = this.createDefaultState(props);
  }

  componentWillReceiveProps(nextProps) {
    const { data, width, height, margin, iterations, nodeWidth, nodePadding, nameKey } = this.props;
    if (nextProps.data !== data || nextProps.width !== width ||
      nextProps.height !== height || !shallowEqual(nextProps.margin, margin) ||
      nextProps.iterations !== iterations || nextProps.nodeWidth !== nodeWidth ||
      nextProps.nodePadding !== nodePadding || nextProps.nameKey !== nameKey) {
      this.setState(this.createDefaultState(this.props));
    }
  }
  /**
   * Returns default, reset state for the sankey chart.
   * @param  {Object} props The latest props
   * @return {Object} Whole new state
   */
  createDefaultState(props) {
    const { data, width, height, margin, iterations, nodeWidth, nodePadding } = props;
    const contentWidth = width - ((margin && margin.left) || 0) - ((margin && margin.right) || 0);
    const contentHeight = height - ((margin && margin.top) || 0) - ((margin && margin.bottom) || 0);
    const { links, nodes } = computeData({
      data,
      width: contentWidth,
      height: contentHeight,
      iterations, nodeWidth, nodePadding,
    });

    return {
      activeElement: null,
      activeElementType: null,
      isTooltipActive: false,
      nodes, links,
    };
  }

  handleMouseEnter(el, type, e) {
    const { onMouseEnter, children } = this.props;
    const tooltipItem = findChildByType(children, Tooltip);

    if (tooltipItem) {
      this.setState({
        activeElement: el,
        activeElementType: type,
        isTooltipActive: true,
      }, () => {
        if (onMouseEnter) {
          onMouseEnter(el, type, e);
        }
      });
    } else if (onMouseEnter) {
      onMouseEnter(el, type, e);
    }
  }

  handleMouseLeave(el, type, e) {
    const { onMouseLeave, children } = this.props;
    const tooltipItem = findChildByType(children, Tooltip);

    if (tooltipItem) {
      this.setState({
        isTooltipActive: false,
      }, () => {
        if (onMouseLeave) {
          onMouseLeave(el, type, e);
        }
      });
    } else if (onMouseLeave) {
      onMouseLeave(el, type, e);
    }
  }

  renderLinkItem(option, props) {
    if (React.isValidElement(option)) {
      return React.cloneElement(option, props);
    } else if (_.isFunction(option)) {
      return option(props);
    }

    const { sourceX, sourceY, sourceControlX, targetX, targetY, targetControlX, linkWidth,
      ...others } = props;

    return (
      <path
        className="recharts-sankey-link"
        d={`
          M${sourceX},${sourceY}
          C${sourceControlX},${sourceY} ${targetControlX},${targetY} ${targetX},${targetY}
        `}
        fill="none"
        stroke="#333"
        strokeWidth={linkWidth}
        strokeOpacity="0.2"
        {...getPresentationAttributes(others)}
      />
    );
  }

  renderLinks(links, nodes) {
    const { linkCurvature, link: linkContent, margin } = this.props;
    const top = margin.top || 0;
    const left = margin.left || 0;

    return (
      <Layer className="recharts-sankey-links" key="recharts-sankey-links">
        {
          links.map((link, i) => {
            const { sy: sourceRelativeY, ty: targetRelativeY, dy: linkWidth } = link;
            const source = nodes[link.source];
            const target = nodes[link.target];
            const sourceX = source.x + source.dx + left;
            const targetX = target.x + left;
            const interpolationFunc = interpolationGenerator(sourceX, targetX);
            const sourceControlX = interpolationFunc(linkCurvature);
            const targetControlX = interpolationFunc(1 - linkCurvature);
            const sourceY = source.y + sourceRelativeY + linkWidth / 2 + top;
            const targetY = target.y + targetRelativeY + linkWidth / 2 + top;

            const linkProps = {
              sourceX, targetX,
              sourceY, targetY,
              sourceControlX, targetControlX,
              sourceRelativeY, targetRelativeY,
              linkWidth,
              index: i,
              payload: { ...link, source, target },
              ...getPresentationAttributes(linkContent),
            };
            const events = {
              onMouseEnter: this.handleMouseEnter.bind(this, linkProps, 'link'),
              onMouseLeave: this.handleMouseLeave.bind(this, linkProps, 'link'),
            };

            return (
              <Layer key={`link${i}`} {...events}>
                {this.renderLinkItem(linkContent, linkProps)}
              </Layer>
            );
          })
        }
      </Layer>
    );
  }

  renderNodeItem(option, props) {
    if (React.isValidElement(option)) {
      return React.cloneElement(option, props);
    } else if (_.isFunction(option)) {
      return option(props);
    }

    return (
      <Rectangle
        className="recharts-sankey-node"
        fill="#0088fe"
        fillOpacity="0.8"
        {...props}
      />
    );
  }

  renderNodes(nodes) {
    const { node: nodeContent, margin } = this.props;
    const top = margin.top || 0;
    const left = margin.left || 0;

    return (
      <Layer className="recharts-sankey-nodes" key="recharts-sankey-nodes">
        {
          nodes.map((node, i) => {
            const { x, y, dx, dy } = node;
            const nodeProps = {
              ...getPresentationAttributes(nodeContent),
              x: x + left,
              y: y + top,
              width: dx,
              height: dy,
              index: i,
              payload: node,
            };
            const events = {
              onMouseEnter: this.handleMouseEnter.bind(this, nodeProps, 'node'),
              onMouseLeave: this.handleMouseLeave.bind(this, nodeProps, 'node'),
            };

            return (
              <Layer key={`node${i}`} {...events}>
                {this.renderNodeItem(nodeContent, nodeProps)}
              </Layer>
            );
          })
        }
      </Layer>
    );
  }

  renderTooltip() {
    const { children, width, height, nameKey } = this.props;
    const tooltipItem = findChildByType(children, Tooltip);

    if (!tooltipItem) { return null; }

    const { isTooltipActive, activeElement, activeElementType } = this.state;
    const viewBox = { x: 0, y: 0, width, height };
    const coordinate = activeElement ?
      getCoordinateOfTooltip(activeElement, activeElementType) :
      defaultCoordinateOfTooltip;
    const payload = activeElement ?
      getPayloadOfTooltip(activeElement, activeElementType, nameKey) : [];

    return React.cloneElement(tooltipItem, {
      viewBox,
      active: isTooltipActive,
      coordinate,
      label: '',
      payload,
    });
  }

  render() {
    if (!validateWidthHeight(this)) { return null; }

    const { width, height, className, style, children, ...others } = this.props;
    const { links, nodes } = this.state;
    const attrs = getPresentationAttributes(others);

    return (
      <div
        className={classNames('recharts-wrapper', className)}
        style={{ ...style, position: 'relative', cursor: 'default', width, height }}
      >
        <Surface {...attrs} width={width} height={height}>
          {filterSvgElements(children)}
          {this.renderLinks(links, nodes)}
          {this.renderNodes(nodes)}
        </Surface>
        {this.renderTooltip()}
      </div>
    );
  }
}

export default Sankey;


text:
package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;

import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;

import java.util.Collection;
import java.util.stream.Collectors;

/**
 * Drop database discovery type statement updater.
 */
public final class DropDatabaseDiscoveryTypeStatementUpdater implements RuleDefinitionDropUpdater<DropDatabaseDiscoveryTypeStatement, DatabaseDiscoveryRuleConfiguration> {

    private static final String RULE_TYPE = "database discovery";

    @Override
    public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDatabaseDiscoveryTypeStatement sqlStatement,
                                  final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
        String schemaName = shardingSphereMetaData.getName();
        checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
        checkIsExist(schemaName, sqlStatement, currentRuleConfig);
        checkIsInUse(schemaName, sqlStatement, currentRuleConfig);
    }

    private void checkCurrentRuleConfiguration(final String schemaName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
        DistSQLException.predictionThrow(null != currentRuleConfig, new RequiredRuleMissedException(RULE_TYPE, schemaName));
    }

    private void checkIsExist(final String schemaName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
                              final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
        Collection<String> currentRuleNames = currentRuleConfig.getDiscoveryTypes().keySet();
        Collection<String> notExistedRuleNames = sqlStatement.getTypes().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
        DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), new RequiredRuleMissedException(RULE_TYPE, schemaName, notExistedRuleNames));
    }

    private void checkIsInUse(final String schemaName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
                              final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
        Collection<String> heartbeatInUse = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getDiscoveryTypeName).collect(Collectors.toSet());
        Collection<String> invalid = sqlStatement.getTypes().stream().filter(heartbeatInUse::contains).collect(Collectors.toList());
        DistSQLException.predictionThrow(invalid.isEmpty(), new RuleInUsedException(RULE_TYPE, schemaName, invalid));
    }

    @Override
    public boolean updateCurrentRuleConfiguration(final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
        for (String each : sqlStatement.getTypes()) {
            dropRule(currentRuleConfig, each);
        }
        return false;
    }

    private void dropRule(final DatabaseDiscoveryRuleConfiguration currentRuleConfig, final String typeName) {
        if (isNotInUse(currentRuleConfig, typeName)) {
            currentRuleConfig.getDiscoveryTypes().remove(typeName);
        }
    }

    private boolean isNotInUse(final DatabaseDiscoveryRuleConfiguration currentRuleConfig, final String toBeDroppedDiscoveryTypeName) {
        return currentRuleConfig.getDataSources().stream().noneMatch(each -> each.getDiscoveryTypeName().equals(toBeDroppedDiscoveryTypeName));
    }

    @Override
    public Class<DatabaseDiscoveryRuleConfiguration> getRuleConfigurationClass() {
        return DatabaseDiscoveryRuleConfiguration.class;
    }

    @Override
    public String getType() {
        return DropDatabaseDiscoveryTypeStatement.class.getName();
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Herzogia 9(3-4): 628 (1993)

#### Original name
Baeomyces pulogensis Vain.

### Remarks
null


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>React for GitHub Pages</title>


text:
import { UntitledClient, BaseCommand, BaseCommandGroup, BaseCommandDecorators, BaseMessage, disambiguation } from '../../../';
import { GuildExtension } from '../../../extensions/GuildExtension';
import { oneLine, stripIndents } from 'common-tags';
import { Collection, Message } from 'discord.js';

const { name, aliases, group, memberName, description, details, examples, guarded, args } = BaseCommandDecorators;

@name('help')
@aliases('commands')
@group('util')
@memberName('help')
@description('Displays a list of available commands, or detailed information for a specified command.')
@details(oneLine`
	The command may be part of a command name or a whole command name.
	If it isn't specified, all available commands will be listed.
`)
@examples('help', 'help prefix')
@guarded
export class HelpCommand extends BaseCommand {
	@args({
		key: 'command',
		prompt: 'which command would you like to view the help for?\n',
		type: 'string',
		default: ''
	})
	public async run(msg: BaseMessage, { command }: { command: string }): Promise<Message | Message[]> {
		const groups: Collection<string, BaseCommandGroup> = this.client.registry.groups;
		const commands: BaseCommand[] = (this.client.registry.findCommands(command, false, msg) as BaseCommand[]);
		const showAll: boolean = command && command.toLowerCase() === 'all';
		if (command && !showAll) {
			if (commands.length === 1) {
				let help: string = stripIndents`
					${oneLine`
						__Command **${commands[0].name}**:__ ${commands[0].description}
						${commands[0].guildOnly ? ' (Usable only in servers)' : ''}
					`}

					**Format:** ${msg.anyUsage(`${commands[0].name}${commands[0].format ? ` ${commands[0].format}` : ''}`)}
				`;
				if (commands[0].aliases.length > 0) help += `\n**Aliases:** ${commands[0].aliases.join(', ')}`;
				help += `\n${oneLine`
					**Group:** ${commands[0].group.name}
					(\`${commands[0].groupID}:${commands[0].memberName}\`)
				`}`;
				if (commands[0].details) help += `\n**Details:** ${commands[0].details}`;
				if (commands[0].examples) help += `\n**Examples:**\n${commands[0].examples.join('\n')}`;

				const messages: Message[] = [];
				try {
					messages.push((await msg.say(help) as Message));
					/* if (msg.channel.type !== 'dm') messages.push((await msg.reply('sent you a DM with information.') as Message)); */
				} catch (err) {
					/* messages.push((await msg.reply('unable to send you the help DM. You probably have DMs disabled.') as Message)); */
				}
				return (messages as Message[]);
			} else if ((commands as BaseCommand[]).length > 1) {
				return msg.reply(disambiguation((commands as BaseCommand[]), 'commands'));
			} else {
				return msg.reply(
					`Unable to identify command. Use ${msg.usage(
						null, msg.channel.type === 'dm' ? null : undefined, msg.channel.type === 'dm' ? null : undefined
					)} to view the list of all commands.`
				);
			}
		} else {
			const messages: Message[] = [];
			try {
				messages.push((await msg.direct(stripIndents`
					${oneLine`
						To run a command in ${msg.guild || 'any server'},
						use ${BaseCommand.usage('command', msg.guild ? (msg.guild as GuildExtension).commandPrefix : null, this.client.user)}.
						For example, ${BaseCommand.usage('prefix', msg.guild ? (msg.guild as GuildExtension).commandPrefix : null, this.client.user)}.
					`}
					To run a command in this DM, simply use ${BaseCommand.usage('command', null, null)} with no prefix.

					Use ${this.usage('<command>', null, null)} to view detailed information about a specific command.
					Use ${this.usage('all', null, null)} to view a list of *all* commands, not just available ones.

					__**${showAll ? 'All commands' : `Available commands in ${msg.guild || 'this DM'}`}**__

					${(showAll ? groups : groups.filter((grp: BaseCommandGroup) => grp.commands.some((cmd: BaseCommand) => cmd.isUsable(msg))))
						.map(grp => stripIndents`
							__${grp.name}__
							${(showAll ? grp.commands : grp.commands.filter((cmd: BaseCommand) => cmd.isUsable(msg)))
								.map((cmd: BaseCommand) => `**${cmd.name}:** ${cmd.description}`).join('\n')
							}
						`).join('\n\n')
					}
				`, { split: true }) as Message));
				if (msg.channel.type !== 'dm') messages.push((await msg.reply('sent you a DM with information.') as Message));
			} catch (err) {
				messages.push((await msg.reply('unable to send you the help DM. You probably have DMs disabled.') as Message));
			}
			return (messages as Message[]);
		}
	}
}


text:
#include <aws/core/client/AWSError.h>
#include <aws/mediapackage-vod/MediaPackageVodErrorMarshaller.h>
#include <aws/mediapackage-vod/MediaPackageVodErrors.h>

using namespace Aws::Client;
using namespace Aws::MediaPackageVod;

AWSError<CoreErrors> MediaPackageVodErrorMarshaller::FindErrorByName(const char* errorName) const
{
  AWSError<CoreErrors> error = MediaPackageVodErrorMapper::GetErrorForName(errorName);
  if(error.GetErrorType() != CoreErrors::UNKNOWN)
  {
    return error;
  }

  return AWSErrorMarshaller::FindErrorByName(errorName);
}


text: </col></colgroup>		foo


text:
from django.test import TestCase, TransactionTestCase
from nose.tools import raises

from ..models import User
from .model_factories import UserF

class TestCreateSuperUser(TestCase):
    def tearDown(self):
        User.objects.all().delete()

    def test(self):
        email = 'bla@example.com'
        display_name = 'superuser'
        password = 'password'
        user = User.objects.create_superuser(email, display_name, password)

        self.assertTrue(user.is_superuser)
        self.assertEqual(user.email, email)
        self.assertEqual(user.display_name, display_name)

    @raises(TypeError)
    def test_without_password(self):
        email = 'bla@example.com'
        display_name = 'superuser'
        User.objects.create_superuser(email, display_name)

        self.assertTrue(True)

class TestCreateUser(TransactionTestCase):
    def tearDown(self):
        User.objects.all().delete()

    def test(self):
        email = 'bla@example.com'
        display_name = 'user'
        password = 'password'
        user = User.objects.create_user(email, display_name, password)

        self.assertFalse(user.is_superuser)
        self.assertEqual(user.email, email)
        self.assertEqual(user.display_name, display_name)

    def test_without_password(self):
        email = 'bla@example.com'
        display_name = 'user'
        user = User.objects.create_user(email, display_name)

        self.assertFalse(user.is_superuser)
        self.assertEqual(user.email, email)
        self.assertEqual(user.display_name, display_name)

class TestGetUser(TestCase):
    def test(self):
        email = 'bla@example.com'
        display_name = 'user'
        password = 'password'
        user = User.objects.create_user(email, display_name, password)

        self.assertEqual(
            user, User.objects.get_by_natural_key(user.email)
        )
        self.assertEqual(
            user, User.objects.get_by_natural_key('BLA@example.com')
        )


text:
package com.github.andrewapj.simplehelpdesk.domain;

import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@Entity
@Table(name = "role")
public class Role implements Serializable {

    /*
     *  Instance variables
     */

    @Id
    @GeneratedValue
    private Long id;

    @NotNull
    @Length(min = 1, max = 64, message = "The role must be between 1 " +
            "and 64 characters in length")
    @Column(name = "name", length = 64, unique = true, nullable = false)
    private String name;

    /*
     *  Constructors
     */

    // JPA mandatory no-argument constructor
    public Role() {
    }

    public Role(final String name) {
        this.name = name;
    }

    /*
     * Equals & Hashcode
     */

    @Override
    public final boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Role)) return false;

        Role role = (Role) o;

        return name != null ? name.equals(role.name) : role.name == null;
    }

    @Override
    public final int hashCode() {
        return name != null ? name.hashCode() : 0;
    }

    /*
     * Getters / Setters
     */

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }
}


text:
``monoseq``
===========

``monoseq`` is a Python library for pretty-printing sequence strings using a
monospace font. It also provides a simple command line interface.

Sequences are pretty-printed in the for DNA and proteins traditional way
using blocks of letters where each line is prefixed with the sequence
position. User-specified regions are highlighted using different formatting
styles. The output format can be HTML or plaintext with optional styling
using ANSI escape codes for use in a terminal.

.. code-block:: pycon

    >>> import monoseq
    >>> sequence = 'MIMANQPLWLDSEVEMNHYQQSHIKSKSPYFPEDKHICWIKIFKAFGT' * 4
    >>> print monoseq.pprint_sequence(sequence, mode='plaintext')
      1  MIMANQPLWL DSEVEMNHYQ QSHIKSKSPY FPEDKHICWI KIFKAFGTMI MANQPLWLDS
     61  EVEMNHYQQS HIKSKSPYFP EDKHICWIKI FKAFGTMIMA NQPLWLDSEV EMNHYQQSHI
    121  KSKSPYFPED KHICWIKIFK AFGTMIMANQ PLWLDSEVEM NHYQQSHIKS KSPYFPEDKH
    181  ICWIKIFKAF GT

This screenshot shows the use of ANSI escape codes:

.. image:: doc/example-ansi.png
   :alt: Example of formatting with ANSI escape codes

Here is `an example <doc/example-html.html>`_ of ``monoseq`` used to output
HTML, and this `IPython Notebook
<http://nbviewer.ipython.org/github/martijnvermaat/monoseq/blob/master/doc/monoseq.ipynb>`_
shows how to pretty-print sequences in an IPython Notebook.

To install the latest release via PyPI using pip::

    pip install monoseq

Documentation
-------------

The `latest documentation <https://monoseq.readthedocs.org/>`_ with user
guide and API reference is hosted at Read The Docs.

You can also compile the documentation directly from the source code by
running ``make html`` from the ``doc/`` subdirectory. This requires
`Sphinx`_ to be installed.

Copyright
---------

``monoseq`` is licensed under the MIT License, see the LICENSE.rst file
for details. See the AUTHORS.rst file for a list of authors.

.. _Sphinx: http://sphinx-doc.org/


text: :- load_compilation_module(ciaopath).


text:
@implementation LCIWTabBarItem
-(void)setBadgeValue:(NSString *)badgeValue{
    [super setBadgeValue:badgeValue];

    UITabBarController *tabBarCtrl = [self valueForKeyPath:@"_target"];

        //遍历出self.tabBarController.tabBar.subviews 里面子控件
        for (UIView *tabBarChild in tabBarCtrl.tabBar.subviews) {
            if ([tabBarChild isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
                for (UIView *tabBarButtonChild in tabBarChild.subviews) {
                    if ([tabBarButtonChild isKindOfClass:NSClassFromString(@"_UIBadgeView")]) {
                        for (UIView *badgeViewChild in tabBarButtonChild.subviews) {
                            if ([badgeViewChild isKindOfClass:NSClassFromString(@"_UIBadgeBackground")]) {

                                NSLog(@"终于找到你,还好我没放弃");
                                NSLog(@"%@",badgeViewChild);
                                //  badgeViewChild.backgroundColor = [UIColor blackColor];
                                // 虽然找到了,不知道设置其身上什么值去更改那个大红色
                                // 有没有相关的方法去获取其身上的属性再看看

                                unsigned int count;
                                // 获取某个类身上的属性
                                Ivar *ivars = class_copyIvarList([badgeViewChild class],&count);

                                for (int i = 0 ; i < count; i++) {
                                    Ivar ivar = ivars[i];

                                    //  ivar_getName(ivar);
                                    //获取属性名字
                                    NSString *ivarName = [NSString stringWithCString:ivar_getName(ivar) encoding:NSUTF8StringEncoding];
                                    //获取属性类型
                                    NSString *ivarTepy = [NSString stringWithCString:ivar_getTypeEncoding(ivar) encoding:NSUTF8StringEncoding];

                                    NSLog(@"属性姓名:%@ 属性类型:%@",ivarName,ivarTepy);

                                    //如果有就通过KVC赋值图片
                                    if ([ivarName isEqualToString:@"_image"]) {
                                        UIImage *image =[UIImage imageNamed:@"main_badge"];
                                        [badgeViewChild setValue:image forKey:@"image"];

                                    }

                                }

                            }

                        }

                    }
                }

            }

        }

    }

@end


text:
Getting Started
===============

The first step when using the Py-Authorize API is to initialize the client
with your Authorize.net API login name and transaction key. The
initialization will only need to occur once in your application and must be
setup before any other API calls are used.

Test Environment
~~~~~~~~~~~~~~~~

.. code-block:: python

    import authorize

    authorize.Configuration.configure(
        authorize.Environment.TEST,
        'api_login_id',
        'api_transaction_key',
    )

In addition to the Authorize.net API login name and transaction key, the
``configure`` method also takes an ``Environment`` parameter. For development
and testing configurations users should use the ``Environment.TEST'``
variable. For production configurations, users should use the
``Environment.PRODUCTION`` variable:

Production Environment
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

    import authorize

    authorize.Configuration.configure(
        authorize.Environment.PRODUCTION,
        'api_login_id',
        'api_transaction_key',
    )


text:
#import "ORKTimeIntervalPicker.h"
#import "ORKAnswerFormat_Internal.h"
#import "ORKHelpers.h"

@interface ORKDatePicker : UIDatePicker

@end

@implementation ORKDatePicker

- (void)didMoveToWindow {
    [super didMoveToWindow];

    // Work around for UIDatePicker UIControlEventValueChanged only fired on second selection
    dispatch_async(dispatch_get_main_queue(), ^{
        self.countDownDuration = self.countDownDuration;
    });
}

@end

@interface ORKTimeIntervalPicker ()

@property (nonatomic, strong) ORKTimeIntervalAnswerFormat *answerFormat;

@end

@implementation ORKTimeIntervalPicker {
    id _answer;
    __weak id<ORKPickerDelegate> _pickerDelegate;
    ORKDatePicker *_pickerView;
}

@synthesize pickerDelegate = _pickerDelegate;
@synthesize answer = _answer;

- (instancetype)initWithAnswerFormat:(ORKTimeIntervalAnswerFormat *)answerFormat
                              answer:(id)answer
                      pickerDelegate:(id<ORKPickerDelegate>)delegate {
    self = [super init];
    if (self) {
        self.answerFormat = answerFormat;
        self.answer = answer;
        self.pickerDelegate = delegate;
    }
    return self;
}

- (UIView *)pickerView {
    if (_pickerView == nil) {
        _pickerView = [[ORKDatePicker alloc] init];
        _pickerView.datePickerMode = UIDatePickerModeCountDownTimer;
        [_pickerView addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventValueChanged];
        [self setAnswerFormat:_answerFormat];
        [self setAnswer:_answer];
    }
    return _pickerView;
}

- (void)setAnswer:(id)answer {
    _answer = answer;

    NSTimeInterval value;
    if (answer != nil && answer != ORKNullAnswerValue()  && [answer isKindOfClass:[NSNumber class]]) {
        value = ((NSNumber *)answer).doubleValue;
    } else {
        value = [_answerFormat pickerDefaultDuration];
    }

    _pickerView.countDownDuration = value;
}

- (void)setAnswerFormat:(ORKTimeIntervalAnswerFormat *)answerFormat {
    _answerFormat = answerFormat;
    NSAssert([answerFormat isKindOfClass:[ORKTimeIntervalAnswerFormat class]], @"");

    _pickerView.minuteInterval = [answerFormat step];
}

- (NSString *)selectedLabelText {
    return  (_answer == nil || _answer == ORKNullAnswerValue()) ? nil : [ORKTimeIntervalLabelFormatter() stringFromTimeInterval:((NSNumber *)self.answer).floatValue];
}

- (void)pickerWillAppear {
    [self pickerView];
    [self valueDidChange:nil];
}

- (void)valueDidChange:(id)sender {
    NSTimeInterval interval = _pickerView.countDownDuration;
    _answer = @(interval);

    if ([self.pickerDelegate respondsToSelector:@selector(picker:answerDidChangeTo:)]) {
        [self.pickerDelegate picker:self answerDidChangeTo:self.answer];
    }
}

@end