text:
package ladok.lpw.service.registrate.facadeclient;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for personVO complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="personVO">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="annanid" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="avliden" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="emailadr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="enamn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="facknr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fcoadr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fgatadr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fland" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fort" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fpostnr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="fromdat" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="gallrad" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         <element name="gallradDatum" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="konto" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="pnr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="sekel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="sms" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tcoadr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="telnr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tgatadr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tland" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tnamn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tomdat" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tort" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="tpostnr" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "personVO", propOrder = {
    "annanid",
    "avliden",
    "emailadr",
    "enamn",
    "facknr",
    "fcoadr",
    "fgatadr",
    "fland",
    "fort",
    "fpostnr",
    "fromdat",
    "gallrad",
    "gallradDatum",
    "konto",
    "pnr",
    "sekel",
    "sms",
    "tcoadr",
    "telnr",
    "tgatadr",
    "tland",
    "tnamn",
    "tomdat",
    "tort",
    "tpostnr"
})
public class PersonVO {

    protected String annanid;
    protected String avliden;
    protected String emailadr;
    protected String enamn;
    protected String facknr;
    protected String fcoadr;
    protected String fgatadr;
    protected String fland;
    protected String fort;
    protected String fpostnr;
    protected String fromdat;
    protected boolean gallrad;
    protected String gallradDatum;
    protected String konto;
    protected String pnr;
    protected String sekel;
    protected String sms;
    protected String tcoadr;
    protected String telnr;
    protected String tgatadr;
    protected String tland;
    protected String tnamn;
    protected String tomdat;
    protected String tort;
    protected String tpostnr;

    /**
     * Gets the value of the annanid property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAnnanid() {
        return annanid;
    }

    /**
     * Sets the value of the annanid property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAnnanid(String value) {
        this.annanid = value;
    }

    /**
     * Gets the value of the avliden property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAvliden() {
        return avliden;
    }

    /**
     * Sets the value of the avliden property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAvliden(String value) {
        this.avliden = value;
    }

    /**
     * Gets the value of the emailadr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEmailadr() {
        return emailadr;
    }

    /**
     * Sets the value of the emailadr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEmailadr(String value) {
        this.emailadr = value;
    }

    /**
     * Gets the value of the enamn property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEnamn() {
        return enamn;
    }

    /**
     * Sets the value of the enamn property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEnamn(String value) {
        this.enamn = value;
    }

    /**
     * Gets the value of the facknr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFacknr() {
        return facknr;
    }

    /**
     * Sets the value of the facknr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFacknr(String value) {
        this.facknr = value;
    }

    /**
     * Gets the value of the fcoadr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFcoadr() {
        return fcoadr;
    }

    /**
     * Sets the value of the fcoadr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFcoadr(String value) {
        this.fcoadr = value;
    }

    /**
     * Gets the value of the fgatadr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFgatadr() {
        return fgatadr;
    }

    /**
     * Sets the value of the fgatadr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFgatadr(String value) {
        this.fgatadr = value;
    }

    /**
     * Gets the value of the fland property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFland() {
        return fland;
    }

    /**
     * Sets the value of the fland property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFland(String value) {
        this.fland = value;
    }

    /**
     * Gets the value of the fort property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFort() {
        return fort;
    }

    /**
     * Sets the value of the fort property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFort(String value) {
        this.fort = value;
    }

    /**
     * Gets the value of the fpostnr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFpostnr() {
        return fpostnr;
    }

    /**
     * Sets the value of the fpostnr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFpostnr(String value) {
        this.fpostnr = value;
    }

    /**
     * Gets the value of the fromdat property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFromdat() {
        return fromdat;
    }

    /**
     * Sets the value of the fromdat property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFromdat(String value) {
        this.fromdat = value;
    }

    /**
     * Gets the value of the gallrad property.
     *
     */
    public boolean isGallrad() {
        return gallrad;
    }

    /**
     * Sets the value of the gallrad property.
     *
     */
    public void setGallrad(boolean value) {
        this.gallrad = value;
    }

    /**
     * Gets the value of the gallradDatum property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getGallradDatum() {
        return gallradDatum;
    }

    /**
     * Sets the value of the gallradDatum property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setGallradDatum(String value) {
        this.gallradDatum = value;
    }

    /**
     * Gets the value of the konto property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getKonto() {
        return konto;
    }

    /**
     * Sets the value of the konto property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setKonto(String value) {
        this.konto = value;
    }

    /**
     * Gets the value of the pnr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPnr() {
        return pnr;
    }

    /**
     * Sets the value of the pnr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPnr(String value) {
        this.pnr = value;
    }

    /**
     * Gets the value of the sekel property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSekel() {
        return sekel;
    }

    /**
     * Sets the value of the sekel property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSekel(String value) {
        this.sekel = value;
    }

    /**
     * Gets the value of the sms property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSms() {
        return sms;
    }

    /**
     * Sets the value of the sms property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSms(String value) {
        this.sms = value;
    }

    /**
     * Gets the value of the tcoadr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTcoadr() {
        return tcoadr;
    }

    /**
     * Sets the value of the tcoadr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTcoadr(String value) {
        this.tcoadr = value;
    }

    /**
     * Gets the value of the telnr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTelnr() {
        return telnr;
    }

    /**
     * Sets the value of the telnr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTelnr(String value) {
        this.telnr = value;
    }

    /**
     * Gets the value of the tgatadr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTgatadr() {
        return tgatadr;
    }

    /**
     * Sets the value of the tgatadr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTgatadr(String value) {
        this.tgatadr = value;
    }

    /**
     * Gets the value of the tland property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTland() {
        return tland;
    }

    /**
     * Sets the value of the tland property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTland(String value) {
        this.tland = value;
    }

    /**
     * Gets the value of the tnamn property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTnamn() {
        return tnamn;
    }

    /**
     * Sets the value of the tnamn property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTnamn(String value) {
        this.tnamn = value;
    }

    /**
     * Gets the value of the tomdat property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTomdat() {
        return tomdat;
    }

    /**
     * Sets the value of the tomdat property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTomdat(String value) {
        this.tomdat = value;
    }

    /**
     * Gets the value of the tort property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTort() {
        return tort;
    }

    /**
     * Sets the value of the tort property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTort(String value) {
        this.tort = value;
    }

    /**
     * Gets the value of the tpostnr property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTpostnr() {
        return tpostnr;
    }

    /**
     * Sets the value of the tpostnr property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTpostnr(String value) {
        this.tpostnr = value;
    }

}


text:
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { Component } from 'react';
import * as ReactDOM from 'react-dom';
import Pagination from 'material-ui-pagination';
import * as ui from 'material-ui';
import { MuiThemeProvider } from 'material-ui/styles';
import injectTapEventPlugin = require('react-tap-event-plugin');

// Needed for onTouchTap
// Check this repo:
// https://github.com/zilverline/react-tap-event-plugin
injectTapEventPlugin();

interface PagerState {
	pageIndex: number;
}

class Pager extends React.Component<{}, PagerState> {
	constructor() {
		super({});
		this.state = {
			pageIndex: 0
		};
	}
	setPageIndex = (pageIndex: number) => {
		this.setState({ pageIndex });
	}
	render() {
		const { pageIndex } = this.state;
		const length = 100;
		const perPage = 10;
		const totalPage = Math.floor(length / perPage);

		const list: JSX.Element[] = [];
		for (let i = pageIndex * perPage; i < (pageIndex * perPage + perPage); i++) {
			list.push(<p key={`${i}`}>{`No.${i}`}
);
		}

		return (

			<ui.Card>
				<Pagination
					total={totalPage}
					display={8}
					current={pageIndex}
					onChange={this.setPageIndex}
				/>
			</ui.Card>

				{list}

			<ui.Card>
				<Pagination
					total={totalPage}
					display={8}
					current={pageIndex}
					onChange={this.setPageIndex}
				/>
			</ui.Card>

);
	}
}

const Index = () => (
	<MuiThemeProvider>
		<Pager />
	</MuiThemeProvider>
);

ReactDOM.render(<Index />, document.getElementById('root') as HTMLElement);

redpajama_set_name: RedPajamaGithub


text:
package com.fatboyindustrial.gsonjavatime;

import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

/**
 * The {@code Converters} class contains static methods for registering Java Time converters.
 */
@SuppressWarnings({ "UnusedReturnValue", "WeakerAccess" })
public class Converters
{
  /** The specific genericized type for {@code LocalDate}. */
  public static final Type LOCAL_DATE_TYPE = new TypeToken<LocalDate>(){}.getType();

  /** The specific genericized type for {@code LocalDateTime}. */
  public static final Type LOCAL_DATE_TIME_TYPE = new TypeToken<LocalDateTime>(){}.getType();

  /** The specific genericized type for {@code LocalTime}. */
  public static final Type LOCAL_TIME_TYPE = new TypeToken<LocalTime>(){}.getType();

  /** The specific genericized type for {@code OffsetDateTime}. */
  public static final Type OFFSET_DATE_TIME_TYPE = new TypeToken<OffsetDateTime>(){}.getType();

  /** The specific genericized type for {@code OffsetTime}. */
  public static final Type OFFSET_TIME_TYPE = new TypeToken<OffsetTime>(){}.getType();

  /** The specific genericized type for {@code ZonedDateTime}. */
  public static final Type ZONED_DATE_TIME_TYPE = new TypeToken<ZonedDateTime>(){}.getType();

  /** The specific genericized type for {@code Instant}. */
  public static final Type INSTANT_TYPE = new TypeToken<Instant>(){}.getType();

  /** The specific genericized type for {@code ZoneId}. */
  public static final Type ZONE_ID_TYPE = new TypeToken<ZoneId>(){}.getType();

  /**
   * Registers all the Java Time converters.
   * @param builder The GSON builder to register the converters with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerAll(GsonBuilder builder)
  {
    if (builder == null) { throw new NullPointerException("builder cannot be null"); }

    registerLocalDate(builder);
    registerLocalDateTime(builder);
    registerLocalTime(builder);
    registerOffsetDateTime(builder);
    registerOffsetTime(builder);
    registerZonedDateTime(builder);
    registerInstant(builder);
    registerZoneId(builder);

    return builder;
  }

  /**
   * Registers the {@link LocalDateConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerLocalDate(GsonBuilder builder)
  {
    builder.registerTypeAdapter(LOCAL_DATE_TYPE, new LocalDateConverter());

    return builder;
  }

  /**
   * Registers the {@link LocalDateTimeConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerLocalDateTime(GsonBuilder builder)
  {
    builder.registerTypeAdapter(LOCAL_DATE_TIME_TYPE, new LocalDateTimeConverter());

    return builder;
  }

  /**
   * Registers the {@link LocalTimeConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerLocalTime(GsonBuilder builder)
  {
    builder.registerTypeAdapter(LOCAL_TIME_TYPE, new LocalTimeConverter());

    return builder;
  }

  /**
   * Registers the {@link OffsetDateTimeConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerOffsetDateTime(GsonBuilder builder)
  {
    builder.registerTypeAdapter(OFFSET_DATE_TIME_TYPE, new OffsetDateTimeConverter());

    return builder;
  }

  /**
   * Registers the {@link OffsetTimeConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerOffsetTime(GsonBuilder builder)
  {
    builder.registerTypeAdapter(OFFSET_TIME_TYPE, new OffsetTimeConverter());

    return builder;
  }

  /**
   * Registers the {@link ZonedDateTimeConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerZonedDateTime(GsonBuilder builder)
  {
    builder.registerTypeAdapter(ZONED_DATE_TIME_TYPE, new ZonedDateTimeConverter());

    return builder;
  }

  /**
   * Registers the {@link InstantConverter} converter.
   * @param builder The GSON builder to register the converter with.
   * @return A reference to {@code builder}.
   */
  public static GsonBuilder registerInstant(GsonBuilder builder)
  {
    builder.registerTypeAdapter(INSTANT_TYPE, new InstantConverter());

    return builder;
  }

    /**
     * Registers the {@link ZoneIdConverter} converter.
     * @param builder The GSON builder to register the converter with.
     * @return A reference to {@code builder}.
     */
   public static GsonBuilder registerZoneId(GsonBuilder builder)
   {
     builder.registerTypeAdapter(ZONE_ID_TYPE, new ZoneIdConverter());

     return builder;
   }
}


text:
exports = module.exports = function(app, mongoose) {
  //general sub docs
  require('./schema/Note')(app, mongoose);
  require('./schema/Status')(app, mongoose);
  require('./schema/StatusLog')(app, mongoose);
  require('./schema/Category')(app, mongoose);

  //user system
  require('./schema/User')(app, mongoose);
  require('./schema/Admin')(app, mongoose);
  require('./schema/AdminGroup')(app, mongoose);
  require('./schema/Account')(app, mongoose);
}


text:
package org.apache.apex.malhar.lib.converter;

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

import org.junit.Assert;
import org.junit.Test;

import org.apache.apex.malhar.lib.testbench.CollectorTestSink;
import org.apache.apex.malhar.lib.util.TestUtils;

public class StringValueToNumberConverterForMapTest
{

  @Test
  public void testStringValueToNumericConversion()
  {
    StringValueToNumberConverterForMap<String> testop = new StringValueToNumberConverterForMap<String>();
    String[] values = {"1.0", "2.0", "3.0"};
    String[] keys = {"a", "b", "c"};

    HashMap<String, String> inputMap = new HashMap<String, String>();

    for (int i = 0; i < 3; i++) {
      inputMap.put(keys[i], values[i]);
    }

    CollectorTestSink<Map<String, Number>> testsink = new CollectorTestSink<Map<String, Number>>();
    TestUtils.setSink(testop.output, testsink);

    testop.beginWindow(0);

    testop.input.put(inputMap);

    testop.endWindow();

    Assert.assertEquals(1,testsink.collectedTuples.size());

    Map<String, Number> output = testsink.collectedTuples.get(0);

    Assert.assertEquals(output.get("a"), 1.0);
    Assert.assertEquals(output.get("b"), 2.0);
    Assert.assertEquals(output.get("c"), 3.0);

  }
}


text:
TESTS = test/*.test.js
REPORTER = spec
TIMEOUT = 10000
MOCHA_OPTS =

install:
	@npm install

test: install
	@NODE_ENV=test ./node_modules/mocha/bin/mocha \
		--reporter $(REPORTER) \
		--timeout $(TIMEOUT) \
		$(MOCHA_OPTS) \
		$(TESTS)

test-cov: install
	@NODE_HBASE_CLENT_COV=1 $(MAKE) test MOCHA_OPTS="--require blanket" REPORTER=dot
	@NODE_HBASE_CLENT_COV=1 $(MAKE) test MOCHA_OPTS="--require blanket" REPORTER=html-cov > coverage.html

.PHONY: install test test-cov


text:
cd tests/ab

wstest -m fuzzingserver -s fuzzingserver.json &
sleep 5
php clientRunner.php

sleep 2

php startServer.php &
sleep 3
wstest -m fuzzingclient -s fuzzingclient.json


text:
"use strict"
gereji.extend('broker', {
	init: function(){
		this.events = [];
		return this;
	},
	on : function() {
		var types = typeof arguments[0] == "string" ? [ arguments[0] ] : arguments[0];
		for ( var i in types) {
			var type = types[i];
			this.events = this.events ? this.events : {};
			this.events[type] = typeof this.events[type] == 'undefined' ? [] : this.events[type];
			this.events[type].push(arguments[1]);
		}
		return this;
	},
	emit : function(_event) {
		_event = typeof _event == "string" ? {type : _event, data : {}} : _event;
		_event.data = typeof _event.data == "undefined" ? {} : _event.data;
		try{
			var listeners = this.events ? this.events[_event.type] : [];
			for(var i in listeners){
				typeof listeners[i] === 'function' && listeners[i](_event);
			}
			return this;
		}catch(e){
			var msg = e.stack ? e.stack : e;
			console && console.log(msg);
		}
	}
});


text:
require 'rails_helper'

RSpec.describe MediaContent, type: :model do
  it 'Returns Large Photo first' do
    photo = Photo.new
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::LARGE,
                                      url: PhotoSize::LARGE)
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::MEDIUM,
                                      url: PhotoSize::MEDIUM)
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::SMALL,
                                      url: PhotoSize::SMALL)
    photo.save
    expect(photo.biggest_size_url).to eq(PhotoSize::LARGE)
  end

  it 'Returns Medium Photo as second option' do
    photo = Photo.new
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::SMALL,
                                      url: PhotoSize::SMALL)
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::MEDIUM,
                                      url: PhotoSize::MEDIUM)
    photo.save
    expect(photo.biggest_size_url).to eq(PhotoSize::MEDIUM)
  end

  it 'Returns original when none available' do
    photo = Photo.new
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::ORIGINAL,
                                      url: PhotoSize::ORIGINAL)
    photo.photo_sizes << PhotoSize.new(label: PhotoSize::SMALL,
                                      url: PhotoSize::SMALL)
    photo.save
    expect(photo.biggest_size_url).to eq(PhotoSize::ORIGINAL)
  end

  it 'Returns empty string when none available' do
    photo = Photo.new
    photo.save
    expect(photo.biggest_size_url).to eq("")
  end
end


text:
require 'test_helper'

class MeasureBaselinesHelperTest < ActionView::TestCase
  setup do
    dump_database
    load_measure_baselines
  end

  test "get_target_range_css_class should treat non-numeric as no data" do
    assert_equal "no-data-value", get_target_range_css_class(nil, nil, nil)
    assert_equal "no-data-value", get_target_range_css_class(nil, "test", nil)
    assert_equal "no-data-value", get_target_range_css_class(nil, "30%", nil)  # Needs it to be a number
  end

  test "get_target_range_css_class should handle poor ranges" do
    assert_equal "poor-measure-value", get_target_range_css_class(nil, 49, false)
    assert_equal "poor-measure-value", get_target_range_css_class(nil, "49", false)
    assert_equal "poor-measure-value", get_target_range_css_class(nil, 49.9, false)
    assert_equal "poor-measure-value", get_target_range_css_class(nil, 0, false)
  end

  test "get_target_range_css_class should handle medium ranges" do
    assert_equal "medium-measure-value", get_target_range_css_class(nil, 69, false)
    assert_equal "medium-measure-value", get_target_range_css_class(nil, "69", false)
    assert_equal "medium-measure-value", get_target_range_css_class(nil, 69.9, false)
    assert_equal "medium-measure-value", get_target_range_css_class(nil, 50, false)
  end

  test "get_target_range_css_class should handle good ranges" do
    assert_equal "good-measure-value", get_target_range_css_class(nil, 100, false)
    assert_equal "good-measure-value", get_target_range_css_class(nil, "100", false)
    assert_equal "good-measure-value", get_target_range_css_class(nil, 70.1, false)
    assert_equal "good-measure-value", get_target_range_css_class(nil, 70, false)
  end

  test "get_target_range_css_class should allow ranges to be changed" do
    original_config = APP_CONFIG["measure_baseline_ranges"]
    APP_CONFIG["measure_baseline_ranges"] = {"good" => 30.0, "medium" => 20.0, "poor" => 0.0}
    assert_equal "good-measure-value", get_target_range_css_class(nil, 30.1, false)
    assert_equal "medium-measure-value", get_target_range_css_class(nil, 20.1, false)
    assert_equal "poor-measure-value", get_target_range_css_class(nil, 0, false)
    APP_CONFIG["measure_baseline_ranges"] = original_config
  end

  test "get_target_range_css_class uses the order of baseline sources for its range" do
    baselines = MeasureBaseline.where(measure_id: "0013")
    assert_equal "good-measure-value", get_target_range_css_class(baselines, 10.1, false)
    assert_equal "medium-measure-value", get_target_range_css_class(baselines, 5.1, false)
    assert_equal "poor-measure-value", get_target_range_css_class(baselines, 0, false)
  end

  test "get_target_range_css_class compares for 'lower is better' measures" do
    original_config = APP_CONFIG["measure_baseline_ranges"]
    APP_CONFIG["measure_baseline_ranges"] = {"good" => 10.0, "medium" => 20.0, "poor" => 100.0}
    assert_equal "good-measure-value", get_target_range_css_class(nil, 9.9, true)
    assert_equal "medium-measure-value", get_target_range_css_class(nil, 19.9, true)
    assert_equal "poor-measure-value", get_target_range_css_class(nil, 20.1, true)
    APP_CONFIG["measure_baseline_ranges"] = original_config
  end

  test "replaces URLs with HTML link" do
    assert_nil auto_link(nil)
    assert_equal "See http://www.google.com", auto_link("See http://www.google.com")
  end

  test "adds footnotes to collection" do
    footnotes = []
    assert_false add_footnote(nil, footnotes)
    assert add_footnote("Test", footnotes)
    assert_equal 1, footnotes.length
    assert_false add_footnote("", footnotes)
  end
end


text:
/*************************************************************************/
/*  webrtc_multiplayer.h                                                 */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef WEBRTC_MULTIPLAYER_H
#define WEBRTC_MULTIPLAYER_H

#include "core/io/networked_multiplayer_peer.h"
#include "webrtc_peer_connection.h"

class WebRTCMultiplayer : public NetworkedMultiplayerPeer {
	GDCLASS(WebRTCMultiplayer, NetworkedMultiplayerPeer);

protected:
	static void _bind_methods();

private:
	enum {
		CH_RELIABLE = 0,
		CH_ORDERED = 1,
		CH_UNRELIABLE = 2,
		CH_RESERVED_MAX = 3
	};

	class ConnectedPeer : public Reference {
	public:
		Ref<WebRTCPeerConnection> connection;
		List<Ref<WebRTCDataChannel>> channels;
		bool connected;

		ConnectedPeer() {
			connected = false;
			for (int i = 0; i < CH_RESERVED_MAX; i++) {
				channels.push_front(Ref<WebRTCDataChannel>());
			}
		}
	};

	uint32_t unique_id;
	int target_peer;
	int client_count;
	bool refuse_connections;
	ConnectionStatus connection_status;
	TransferMode transfer_mode;
	int next_packet_peer;
	bool server_compat;

	Map<int, Ref<ConnectedPeer>> peer_map;

	void _peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict);
	void _find_next_peer();

public:
	WebRTCMultiplayer();
	~WebRTCMultiplayer();

	Error initialize(int p_self_id, bool p_server_compat = false);
	Error add_peer(Ref<WebRTCPeerConnection> p_peer, int p_peer_id, int p_unreliable_lifetime = 1);
	void remove_peer(int p_peer_id);
	bool has_peer(int p_peer_id);
	Dictionary get_peer(int p_peer_id);
	Dictionary get_peers();
	void close();

	// PacketPeer
	Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) override; ///< buffer is GONE after next get_packet
	Error put_packet(const uint8_t *p_buffer, int p_buffer_size) override;
	int get_available_packet_count() const override;
	int get_max_packet_size() const override;

	// NetworkedMultiplayerPeer
	void set_transfer_mode(TransferMode p_mode) override;
	TransferMode get_transfer_mode() const override;
	void set_target_peer(int p_peer_id) override;

	int get_unique_id() const override;
	int get_packet_peer() const override;

	bool is_server() const override;

	void poll() override;

	void set_refuse_new_connections(bool p_enable) override;
	bool is_refusing_new_connections() const override;

	ConnectionStatus get_connection_status() const override;
};

#endif


text:
/**
 * This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
 */

#ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
#define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_

#include <jsonrpccpp/client.h>

class WebThreeStubClient : public jsonrpc::Client
{
    public:
        WebThreeStubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}

        std::string web3_sha3(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("web3_sha3",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string web3_clientVersion() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("web3_clientVersion",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string net_version() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("net_version",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string net_peerCount() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("net_peerCount",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool net_listening() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("net_listening",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_protocolVersion() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_protocolVersion",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_hashrate() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_hashrate",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_coinbase",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool eth_mining() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_mining",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_gasPrice",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_accounts() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_accounts",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_blockNumber() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_blockNumber",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getBalance(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getBalance",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getStorageAt(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            p.append(param3);
            Json::Value result = this->CallMethod("eth_getStorageAt",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getTransactionCount(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getTransactionCount",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getBlockTransactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getBlockTransactionCountByHash",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getBlockTransactionCountByNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getBlockTransactionCountByNumber",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getUncleCountByBlockHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getUncleCountByBlockHash",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getUncleCountByBlockNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getUncleCountByBlockNumber",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_getCode(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getCode",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_sendTransaction(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_sendTransaction",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_call(const Json::Value& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_call",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool eth_flush() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_flush",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getBlockByHash(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getBlockByHash",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getBlockByNumber(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getBlockByNumber",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getTransactionByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getTransactionByHash",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getTransactionByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getTransactionByBlockHashAndIndex",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getTransactionByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getTransactionByBlockNumberAndIndex",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getUncleByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getUncleByBlockHashAndIndex",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getUncleByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_getUncleByBlockNumberAndIndex",p);
            if (result.isObject())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getCompilers() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_getCompilers",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_compileLLL(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_compileLLL",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_compileSerpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_compileSerpent",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_compileSolidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_compileSolidity",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_newFilter",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_newBlockFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_newBlockFilter",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool eth_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_uninstallFilter",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getFilterChanges",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getFilterLogs(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getFilterLogs",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getLogs(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_getLogs",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_getWork() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("eth_getWork",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool eth_submitWork(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("eth_submitWork",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string eth_register(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_register",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool eth_unregister(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_unregister",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value eth_fetchQueuedTransactions(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("eth_fetchQueuedTransactions",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            p.append(param3);
            Json::Value result = this->CallMethod("db_put",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("db_get",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_post",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string shh_newIdentity() throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p = Json::nullValue;
            Json::Value result = this->CallMethod("shh_newIdentity",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool shh_hasIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_hasIdentity",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("shh_newGroup",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            p.append(param2);
            Json::Value result = this->CallMethod("shh_addToGroup",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        std::string shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_newFilter",p);
            if (result.isString())
                return result.asString();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        bool shh_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_uninstallFilter",p);
            if (result.isBool())
                return result.asBool();
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value shh_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_getFilterChanges",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
        Json::Value shh_getMessages(const std::string& param1) throw (jsonrpc::JsonRpcException)
        {
            Json::Value p;
            p.append(param1);
            Json::Value result = this->CallMethod("shh_getMessages",p);
            if (result.isArray())
                return result;
            else
                throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
        }
};

#endif //JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_


text:
sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET -2|g"								  $IROOT/ULib/benchmark.cfg
sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g"								  $IROOT/ULib/benchmark.cfg
sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"					  $IROOT/ULib/benchmark.cfg
sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT/ULib/benchmark.cfg

# 2. Start ULib Server (userver_tcp)
export ORM_DRIVER="mysql"
export UMEMPOOL="146,0,0,90,150,-22,-12,-20,0"
export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=hello_world"

$IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &


text:
<!DOCTYPE html>
<html>
  <head>
    <link type="text/css" rel="stylesheet" href="/static/css/style.css"/>
    {% block head %}{% endblock %}
    <title>{% block title %}{% endblock %}</title>
  </head>
  <body>
    <div id="container">{% block body %}{% endblock %}    </div>
  </body>
</html>


text:
package config

import (
	"fmt"
	"path/filepath"

	log "github.com/cihub/seelog"
	"github.com/mitchellh/go-homedir"
)

func SetupLogger() {
	logger, err := log.LoggerFromConfigAsString(loggerConfig())
	if err == nil {
		log.ReplaceLogger(logger)
	} else {
		log.Error(err)
	}
}

func loggerConfig() string {
	logfile, err := homedir.Expand("~/.ecr/log/ecr-login.log")
	if err != nil {
		fmt.Errorf("%v", err)
		logfile = "/tmp/.ecr/log/ecr-login.log"
	}
	// Clean the path to replace with OS-specific separators
	logfile = filepath.Clean(logfile)
	config := `
	<seelog type="asyncloop" minlevel="debug">
		<outputs formatid="main">
			<rollingfile filename="` + logfile + `" type="date"
			 datepattern="2006-01-02-15" archivetype="none" maxrolls="2" />
			<filter levels="warn,error,critical">
				<console />
			</filter>
		</outputs>
		<formats>
			<format id="main" format="%UTCDate(2006-01-02T15:04:05Z07:00) [%LEVEL] %Msg%n" />
		</formats>
	</seelog>
`
	return config
}


text:
var sync = require('./test_basic_sync.js');
var async = require('./test_basic_async.js');

var connect = require('./test_connect.js');

var serialization_json = require('./test_serialization_json.js');
var serialization_msgpack = require('./test_serialization_msgpack.js');
var serialization_cbor = require('./test_serialization_cbor.js');

var rawsocket_transport = require('./test_rawsocket_transport.js');

var rpc_complex = require('./test_rpc_complex.js');
var rpc_arguments = require('./test_rpc_arguments.js');
var rpc_error = require('./test_rpc_error.js');
var rpc_options = require('./test_rpc_options.js');
var rpc_progress = require('./test_rpc_progress.js');
var rpc_slowsquare = require('./test_rpc_slowsquare.js');
var rpc_routing = require('./test_rpc_routing.js');
var rpc_request_id_sequence = require('./test_rpc_request_id_sequence.js');

var pubsub_basic = require('./test_pubsub_basic.js');
var pubsub_complex = require('./test_pubsub_complex.js');
var pubsub_options = require('./test_pubsub_options.js');
var pubsub_excludme = require('./test_pubsub_excludeme.js');
var pubsub_exclude = require('./test_pubsub_exclude.js');
var pubsub_eligible = require('./test_pubsub_eligible.js');
var pubsub_prefix_sub = require('./test_pubsub_prefix_sub.js');
var pubsub_wildcard_sub = require('./test_pubsub_wildcard_sub.js');
var pubsub_multiple_matching_subs = require('./test_pubsub_multiple_matching_subs.js');

exports.testSync = sync.testSync;
exports.testAsync = async.testAsync;

exports.testConnect = connect.testConnect;

exports.testJSONSerialization = serialization_json.testJSONSerialization;
exports.testMsgpackSerialization = serialization_msgpack.testMsgpackSerialization;
exports.testCBORSerialization = serialization_cbor.testCBORSerialization;

exports.testRawSocketTransport = rawsocket_transport.testRawSocketTransport;

exports.testRpcArguments = rpc_arguments.testRpcArguments;
exports.testRpcComplex = rpc_complex.testRpcComplex;
exports.testRpcError = rpc_error.testRpcError;
exports.testRpcOptions = rpc_options.testRpcOptions;
exports.testRpcProgress = rpc_progress.testRpcProgress;
exports.testRpcSlowsquare = rpc_slowsquare.testRpcSlowsquare;
exports.testRpcRouting = rpc_routing.testRpcRouting;
exports.testRpcRequestIdSequence = rpc_request_id_sequence.testRpcRequestIdSequence;

exports.testPubsubBasic = pubsub_basic.testPubsubBasic;
exports.testPubsubComplex = pubsub_complex.testPubsubComplex;
exports.testPubsubOptions = pubsub_options.testPubsubOptions;
exports.testPubsubExcludeMe = pubsub_excludme.testPubsubExcludeMe;
exports.testPubsubExclude = pubsub_exclude.testPubsubExclude;
exports.testPubsubEligible = pubsub_eligible.testPubsubEligible;
exports.testPubsubPrefixSub = pubsub_prefix_sub.testPubsubPrefixSub;
exports.testPubsubWildcardSub = pubsub_wildcard_sub.testPubsubWildcardSub;
exports.testPubsubMultipleMatchingSubs = pubsub_multiple_matching_subs.testPubsubMultipleMatchingSubs;

exports.errorHandlingOnOpen = require('./test_error_handling').errorHandlingOnOpen;
exports.errorHandlingOnClose = require('./test_error_handling').errorHandlingOnClose;
exports.errorHandlingOnEvent = require('./test_error_handling').errorHandlingOnEvent;
exports.errorHandlingOnInvocation = require('./test_error_handling').errorHandlingOnInvocation;


text:
package com.studio.jc.modules.project.service;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.mail.MessagingException;
import javax.mail.internet.AddressException;

import org.apache.commons.io.filefilter.FalseFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.UpdateProvider;
import org.codehaus.groovy.transform.sc.transformers.CompareToNullExpression;
import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import com.mysql.jdbc.Field;
import com.studio.jc.common.persistence.Page;
import com.studio.jc.common.service.CrudService;
import com.studio.jc.modules.common.Constant;
import com.studio.jc.modules.common.enumeration.project.ApplyRecordStateEnum;
import com.studio.jc.modules.common.enumeration.project.IsInEnum;
import com.studio.jc.modules.common.service.SendEmailService;
import com.studio.jc.modules.common.utils.DateUtils;
import com.studio.jc.modules.common.utils.FileUtils;
import com.studio.jc.modules.common.utils.Global;
import com.studio.jc.modules.common.utils.RandomUtils;
import com.studio.jc.modules.common.utils.mail.SimpleMail;
import com.studio.jc.modules.common.utils.mail.SimpleMailSender;
import com.studio.jc.modules.email.service.EmailRecordService;
import com.studio.jc.modules.email.vo.EmailRecordVo;
import com.studio.jc.modules.project.dao.ProjectDao;
import com.studio.jc.modules.project.dao.UserProjectDao;
import com.studio.jc.modules.project.vo.ProjectVo;
import com.studio.jc.modules.project.vo.UserProjectVo;
import com.studio.jc.modules.sys.dao.UserDao;
import com.studio.jc.modules.sys.entity.Role;
import com.studio.jc.modules.sys.entity.User;
import com.studio.jc.modules.sys.utils.UserUtils;

import oracle.jdbc.Const;

@Service
@Transactional(readOnly = true)
public class ProjectService extends CrudService<ProjectDao, ProjectVo>{
	@Autowired
	private ProjectDao projectDao;
	@Autowired
	private EmailRecordService emailRecordService;
	@Autowired
	private UserDao userDao;

	@Autowired
	private UserProjectDao userProjectDao;

	private SimpleMailSender mailSender = SimpleMailSender.getInstance();

	/**
	 * 获取项目信息
	 * @return
	 */
	public ProjectVo get(ProjectVo project){
		ProjectVo p = projectDao.get(project);
		//获取项目成员
		List<User> userList = projectDao.findProjectMember(project.getId());

		p.setUserList(userList);

		return p;
	}

	@Transactional(readOnly = false)
	public void update(ProjectVo project, MultipartFile[] files) throws IllegalStateException, IOException{
		projectDao.update(project);
		MultipartFile file = files[0];
		if(file.getSize() > 0){
			//删除原来的,覆盖现在的
			projectDao.deleteFile(project.getId());
			//上传
			String fileName = FileUtils.uploadFile(file, Global.getConfig("projectFilePath"));
//			String s = fileName.substring(fileName.lastIndexOf("_")+1);
			//入库
			projectDao.insertProjectFile(RandomUtils.getUUID(), project.getId(), fileName);
		}
//		if(null != files && files.length > 0){
//			//删除原来的,覆盖现在的
//			projectDao.deleteFile(project.getId());
//			MultipartFile file = files[0];
//			//上传
//			String fileName = FileUtils.uploadFile(file, Global.getConfig("projectFilePath"));
////			String s = fileName.substring(fileName.lastIndexOf("_")+1);
//			//入库
//			projectDao.insertProjectFile(RandomUtils.getUUID(), project.getId(), fileName);
//
//		}

		//判断文件
	}

	@Transactional(readOnly = false)
	public void agreeUserToPro(UserProjectVo userProject, SimpleMail mail, String agree){

		//根据UserId,找到邮箱
		if(StringUtils.equals(agree, "1")){
			userProject.setId(RandomUtils.getUUID());
			userProject.setPost("0");
			projectDao.insertUserProject(userProject);
			//修改apply_record的state字段
			projectDao.updateApplyRecordState(userProject, "1");
		}else{
			projectDao.updateApplyRecordState(userProject, "0");
		}
		User user = userDao.get(userProject.getUserId());

		try {
			mailSender.send(user.getEmail(), mail);
		} catch (AddressException e) {
			e.printStackTrace();
		} catch (MessagingException e) {
			e.printStackTrace();
		}
//		Integer
	}

	/**
	 *
	 */
	public ProjectVo getById(String projectId){
		return projectDao.getById(projectId);
	}

	/**
	 * 撤销申请
	 * @param project
	 */
	@Transactional(readOnly = false)
	public void backoutApply(ProjectVo project){
		projectDao.deleteApplyRecord(project);
	}

	public Page<UserProjectVo> pageReplyRecord(Page<UserProjectVo> page, UserProjectVo userProject){
		page.setOrderBy("up.apply_time DESC ");
		userProject.setPage(page);
		List<UserProjectVo> list = projectDao.pageApplyRecord(userProject);
		Date nowDate = new Date();

		for(UserProjectVo up : list){
			Integer count = projectDao.selectJoinCount(up.getProjectId());
			if(null == count){
				count = 0;
			}

			//处理过期
			up.setJoinCountDes(count + "/" + up.getMemberCount());
			if(DateUtils.compareTwoDate(nowDate, up.getDeadline())){
				up.setIsDeadline("0");
			}else{
				up.setIsDeadline("1");
			}

			//处理是否通过
			Integer countIsIn = projectDao.getCountUserProjectByUserIdAndProjectId(up.getUserId(), up.getProjectId());
			if(countIsIn == 0){
				up.setIsIn("0");
			}else{
				up.setIsIn("1");
			}
		}

		page.setList(list);
		return page;
	}

	public Integer getCountUserProjectByUserIdAndProjectId(String userId, String projectId){

		return projectDao.getCountUserProjectByUserIdAndProjectId(userId, projectId);
	}

	/**
	 * 获取详情
	 * @param project
	 * @return
	 */
	public ProjectVo getDetails(ProjectVo project){
		boolean isAdmin = false;
		User user = UserUtils.getUser();
		for(Role role : user.getRoleList()){
			if(role.getId().equals(Constant.SYS_ADMIN_ID)){
				isAdmin = true;
				break;
			}
		}
		if(!isAdmin){
			project.setIsAdmin("0");
		}

		ProjectVo p = projectDao.get(project);
		if(null == p.getFilePath()){
			p.setFilePath("");
		}

		Integer count = projectDao.countUserJoinInproject(p.getId());
		if(null == count){
			count = 0;
		}
		//设置信息
		p.setMemberCountDes(count + "/" + p.getMemberCount());

		//取得参与人的信息
//		List<User> userList = projectDao.findProjectMember(project.getId());
		List<User> userList = projectDao.findProjectMember(p.getId());
		p.setUserList(userList);

		return p;
	}

	@Transactional(readOnly = false)
	public void insertApplyRecord(ProjectVo project){
		//根据projectId取出这个项目,查看他是否过期
		ProjectVo p = new ProjectVo();
		p.setId(project.getProjectId());
		ProjectVo pj = projectDao.get(p);
			//申请不设置这个门槛

		//检查

		if(DateUtils.compareTwoDate(pj.getDeadline(), new Date())){
			UserProjectVo up = projectDao.findApplyRecordOfMaxApplyTime(new UserProjectVo(project.getUserId(), project.getProjectId()));
			if(null == up){
				project.setId(RandomUtils.getUUID());
				projectDao.insertApplyRecord(project);
			}else{
				if(up.getState().equals(ApplyRecordStateEnum.NOT_DEAL.messege) ||
						up.getState().equals(ApplyRecordStateEnum.AGREE.messege)){
					//异常
					throw new org.springframework.dao.DuplicateKeyException(null);
				}else if(up.getState().equals(ApplyRecordStateEnum.REJECT.messege)){
					Date nowDate = new Date();
					Date applyDate = up.getApplyTime();
					if(DateUtils.getDistanceOfTwoDate(applyDate, nowDate) >= 1){
						//可以申请
						project.setId(RandomUtils.getUUID());
						projectDao.insertApplyRecord(project);
					}else{
						throw new org.springframework.dao.DuplicateKeyException(null);
					}
				}
			}

		}else{
			throw new RuntimeException();
		}
	}

	/**
	 * 逻辑删除项目
	 * @param id
	 */
	@Transactional(readOnly = false)
	public void deleteLogically(String id){
		projectDao.deleteLogically(id);
	}

	/**
	 *项目发布成功后,给用户发送邮件
	 */
	public void SendEmailService(final SimpleMail mail){

		//获取所有用户
		User user = new User();
		user.setDelFlag("0");

		List<User> userList = userDao.pageUser(user);
		final List<String> emailList = new ArrayList<String>();
		//除去管理员
		User creater = UserUtils.getUser();
		String createId = creater.getId();
		for(User u : userList){
			if(!u.getId().equals(createId)){
				emailList.add(u.getEmail());
			}else{
				continue;
			}
		}

		//创建进程发送邮件 List<String> recipients, SimpleMail mail
		Thread t = new Thread(){
			public void run(){

				for(String eamilAddr : emailList){
					try {
						mailSender.send(eamilAddr, mail);
						//获取
						EmailRecordVo emailRecord = new EmailRecordVo(
								mailSender.getEmailAddress(), eamilAddr, mail);
						emailRecord.setSendTime(new Date());
						emailRecord.setIsSuccess("1");
						emailRecordService.insert(emailRecord);

						System.out.println("发送邮件到" + eamilAddr + "成功");
					} catch (AddressException e) {
						EmailRecordVo emailRecord = new EmailRecordVo(
								mailSender.getEmailAddress(), eamilAddr, mail);
						emailRecord.setSendTime(new Date());
						emailRecord.setIsSuccess("0");
						emailRecord.setFailReason(e.getClass().getName());
						emailRecordService.insert(emailRecord);

						e.printStackTrace();
					} catch (MessagingException e) {
						EmailRecordVo emailRecord = new EmailRecordVo(
								mailSender.getEmailAddress(), eamilAddr, mail);
						emailRecord.setSendTime(new Date());
						emailRecord.setIsSuccess("0");
						emailRecord.setFailReason(e.getClass().getName());
						emailRecordService.insert(emailRecord);

						e.printStackTrace();
					}
				}
			}
		};

		t.start();
	}

	@Transactional(readOnly = false)
	public void releaseProject(ProjectVo project){
		project.setId(RandomUtils.getUUID());
		String createrId = UserUtils.getUser().getId();
		project.setCreaterId(createrId);

		projectDao.insert(project);
	}

	@Transactional(readOnly = false)
	public void insertProjectFile(String projectId, String filePath){
		projectDao.insertProjectFile(RandomUtils.getUUID(), projectId, filePath);
	}

	public Page<ProjectVo> pageProject(Page<ProjectVo> page, ProjectVo project){
		page.setOrderBy("p.create_time desc");  //按照创建时间排序
		boolean isAdmin = false;
		User user = UserUtils.getUser();
		//获得用户本身自己的id
		String userId = user.getId();
		List<Role> roleList = user.getRoleList();
		for(Role role : roleList){
			if(Constant.SYS_ADMIN_ID.equals(role.getId())){
				isAdmin = true;
				break;
			}
		}
		if(!isAdmin){
			project.setIsAdmin("0");
		}
		project.setPage(page);
		project.setUserId(userId);
		List<ProjectVo> projectList = projectDao.pageProject(project);

		//当前日期
		Date nowDate = new Date();
		for(ProjectVo p : projectList){
			//处理参与人数
			//获取本项目的参与人数 selectJoinMemberCounta
			Integer joinCount = projectDao.countUserJoinInproject(p.getId());

			if(null == joinCount){
				joinCount = 0;
			}

			p.setMemberCountDes(joinCount + "/" + p.getMemberCount());

			//处理验收标准
			String acceptResult = p.getAcceptResult();
			if(acceptResult.length() >= 15){
				acceptResult = acceptResult.substring(0,15);
				acceptResult += "........";
				p.setAcceptResult(acceptResult);
			}
			//处理项目概述
			String summary = p.getSummary();
			if(summary.length() >= 15){
				summary = summary.substring(0, 15);
				summary += "........";
				p.setSummary(summary);
			}

			//处理日期
			if(DateUtils.compareTwoDate(nowDate, p.getDeadline())){
				p.setIsDeadline("1");
			}else{
				p.setIsDeadline("0");
			}

			UserProjectVo up = projectDao.findApplyRecordByUserIdAndProjectId(new UserProjectVo(userId, p.getId()));
			if(null == up){
				p.setIsIn(IsInEnum.NOT_IN.message);
			}else if(ApplyRecordStateEnum.NOT_DEAL.messege.equals(up.getState())){
				p.setIsIn(IsInEnum.IN_NOT_DEAL.message);
			}else if(ApplyRecordStateEnum.AGREE.messege.equals(up.getState())){
				p.setIsIn(IsInEnum.IN_AGREE.message);
			}else if(ApplyRecordStateEnum.REJECT.messege.equals(up.getState())){
				p.setIsIn(IsInEnum.IN_REJECT.message);
			}

			//处理是否有项目经理
			Integer result = userProjectDao.countManagerOfProject(p.getId(), "1");
			if(null == result){
				result = 0;
			}
			if(result > 0){
				p.setHaveManager("1");
			}else{
				p.setHaveManager("0");
			}
		}

		page.setList(projectList);

		return page;
	}

//	public List<ProjectVo> listAll(ProjectVo project){
//		boolean isAdmin = false;
//		User user = UserUtils.getUser();
//		List<Role> roleList = user.getRoleList();
//		for(Role role : roleList){
//			if(Constant.SYS_ADMIN_ID.equals(role.getId())){
//				isAdmin = true;
//				break;
//			}
//		}
//
//		if(!isAdmin){
//			project.setIsAdmin("0");
//		}
//
//		return projectDao.findList(project);
//	}
}


text:
<?php # -*- coding: utf-8 -*-

namespace Cockpit\Core\Ajax;

interface ActionProviderInterface {

	/**
	 * @param ActionInterface $controller
	 * @param string $action
	 * @return void
	 */
	public function register_admin_action( ActionInterface $controller, $action );

	/**
	 * @param ActionInterface $controller
	 * @param string $action
	 * @return void
	 */
	public function register_public_action( ActionInterface $controller, $action );
}


text:
***NOTE:*** This project is ***Obsolete***. Use the [path-utils](https://github.com/tomaskraus/path-utils) library - it does one thing and does it good.

A minimalistic PHP library/framework for include/require

## features

* application root path
* smart path join
* "bootstrap" file auto include

## Installation

Via composer:
```
composer require tomaskraus/php-includer
```
, or add this snippet to `composer.json`
```json
    "require": {
        "tomaskraus/php-includer": "^0.4"
    },
```

## php-includer usage options

1. **Use as a library**: Create a new `PI` (php includer) instance with your application root path as a parameter.
2. **Use as a framework**: Include `piLoader.php` in your requested page.
It guesses your application root path and creates a new PI instance (a `$pi` variable) with that path guessed.
It also automatically includes an user-defined "bootstrap" file (`pi.bootstrap.php`), an ideal place for your specific initialization piece of code.

### application root path guess logic
1. `piLoader.php` assumes that it is in a `vendor/tomaskraus/php-include` directory.
2. `piLoader.php` assumes that a `vendor` directory is in the application root directory.

## php-includer framework examples

Assume we have our php application in `/var/www/myApp`. A `/var/www/myApp` is our application root path (`./`).

example 1: php-includer in the `./index.php` file
```php
<?php
//A loader. Guesses an application root path and initializes a PhpIncluder instance.
require_once "./vendor/tomaskraus/php-includer/piLoader.php";

//once piLoader is included, a php-includer object ($pi) is available

//provides a web application root path
echo $pi->path(); //echoes "/var/www/myApp/"

//we can create new, non-existing path strings, based on a web application root
$pi->path("conf/file-to-be-created.php"); //returns "/var/www/myapp/conf/file-to-be-created.php".

//path-safe include, wherever you are
include $pi->path("myLib/utils.php"); //includes /var/www/myapp/myLib/utils.php

//smart path join, fixes missing or too many separators
PI::joinPath("myapp/", "/dist/app.zip"); //returns "myapp/dist/app.zip"
PI::joinPath("/var/www", "dist/app.zip"); //returns "/var/www/dist/app.zip", preserves a root slash
//join Windows path
PI::joinPath("C:\\www\\", "/dist/app.zip"); //returns "C:\\www/dist/app.zip", mixed result for Windows path (still works in PHP)
PI::joinPath("C:\\www", "dist/app.zip"); //returns the same...
```
**example 2**: php-includer in the `./login/index.php` file
```php
<?php
//require piLoader
//we are not in application root directory, so we changed the path accordingly
require_once "./../vendor/tomaskraus/php-includer/piLoader.php";

//once piLoader is included, a php-includer object ($pi) is available

//provides a web application root path, even if you are not in application root directory
echo $pi->path(); //echoes "/var/www/myapp/"

//path-safe include, wherever you are (now we are in the "login" subdirectory)
include $pi->path("myLib/utils.php"); //includes /var/www/myapp/myLib/utils.php

```

### bootstrap file

You can create a `pi.bootstrap.php` file in the application root directory and put whatever you want in it.
That bootstrap file will be automatically included, wherever you include/require `piLoader`, regardless of (sub)directory.
A bootstrap file is an ideal place for your specific initialization piece of code.

**note:** this bootstrap file has nothing to do with the [Bootstrap CSS framework](http://getbootstrap.com/)

`pi.bootstrap.php` file example: assume we have a `pi.bootstrap.php` file in `/var/www/myapp` directory:
```php
<?php

//here you can already use a php-includer ($pi) object, it is already included
include $pi->path("conf/config.php"); //includes /var/www/myapp/conf/config.php

//This bootstrap file is a right place to write the class auto loader here
$autoLoaderFile = __DIR__ . "/vendor/autoload.php";
if (file_exists($autoLoaderFile)) {
    require_once $autoLoaderFile;
}

//other, globally needed stuff...

```

This bootstrap file will be automatically included in both `./index.php` and `./login/index.php` files from previous examples.


text:
package org.genesis.arena.corejava.regex;

import java.util.regex.*;

public class REmatch {
    public static void main(String[] argv) {
        String patt = "Q[^u]\\d+\\.";
        Pattern r = Pattern.compile(patt);
        String line = "Order QT300. Now!";
        Matcher m = r.matcher(line);
        if (m.find()) {
            System.out.println(patt + " matches \"" +
                m.group(0) +
                "\" in \"" + line + "\"");
        } else {
            System.out.println("NO MATCH");
        }
    }
}
// END main


text:
*(sorry for the delay, an unexpected situation arose yesterday which meant the challenge could not be written.)*

Nearly every developer has came into contact with syntax highlighting before. Most modern IDEs support it to some degree, and even some text editors such as Notepad++ and gedit support it too. Syntax highlighting is what turns this:

    using System;

    public static class Program
    {
        public static void Main(params string[] args)
        {
            Console.WriteLine("hello, world!");
        }
    }

into [something like this](http://i.imgur.com/DhfeU8D.png). It's very useful and can be applied to almost every programming language, and even some markup languages such as HTML. Your challenge today is to pick any programming language you like and write a converter for it, which will convert source code of the language of your choice to a highlighted format. You have some freedom in that regard.

# Formal Inputs and Outputs

## Input Description

The program is to accept a source code file in the language of choice.

## Output Description

You are to output some format which allows formatted text display. Here are some examples for you to choose.

* You could choose to make your program output HTML/CSS to highlight the syntax. For example, a highlighted keyword `static` could be output as `<span class="syntax-keyword">static</span>` where the CSS `.syntax-keyword` selector makes the keyword bold or in a distinctive colour.
* You could output an image with the text in it, coloured and styled however you like.
* You could use a library such as `ncurses` (or another way, such as `Console.ForegroundColor` for .NET developers) to output coloured text to the terminal directly, siimlar to the style of complex editors such as vim and Emacs.

# Sample Inputs and Outputs

The exact input is up to you. If you're feeling meta, you could test your solution using... your solution. If the program can highlight its own source code, that's brilliant! Of course, this assumes that you write your solution to highlight the language it was written in. If you don't, don't worry - you can write a highlighter for Python in C# if you wish, or for C in Ruby, for example.

# Extension (Easy)

Write an extension to your solution which allows you to toggle on and off the printing of comments, so that when it is disabled, comments are omitted from the output of the solution.

# Extension (Hard)

If your method of output supports it, allow the collapsing of code blocks. [Here is an example in Visual Studio](http://gfycat.com/DefensiveLimpDore). You could achieve this using JavaScript if you output to HTML.


text:
from pyvisdk.thirdparty import Enum

ClusterDasConfigInfoHBDatastoreCandidate = Enum(
    'allFeasibleDs',
    'allFeasibleDsWithUserPreference',
    'userSelectedDs',

)


text:
module Main where

import System.Console.CmdArgs

import HEP.Package.PGS.Type
import HEP.Package.PGS.Command

main :: IO ()
main = do
  putStrLn "hPGS"
  param <- cmdArgs mode

  commandLineProcess param