text:
package com.appleframework.tools.bean;

import com.appleframework.tools.clone.CloneSupport;
import com.appleframework.tools.lang.Assert;
import com.appleframework.tools.util.ClassUtil;
import com.appleframework.tools.util.ReflectUtil;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Map;

/**
 * 动态Bean,通过反射对Bean的相关方法做操作<br>
 * 支持Map和普通Bean
 *
 * @author cruise.xu
 * @since 3.0.7
 */
public class DynaBean extends CloneSupport<DynaBean> implements Serializable{
	private static final long serialVersionUID = 1L;

	private final Class<?> beanClass;
	private final Object bean;

	/**
	 * 创建一个{@link DynaBean}
	 * @param bean 普通Bean
	 * @return {@link DynaBean}
	 */
	public static DynaBean create(Object bean){
		return new DynaBean(bean);
	}
	/**
	 * 创建一个{@link DynaBean}
	 * @param beanClass Bean类
	 * @param params 构造Bean所需要的参数
	 * @return {@link DynaBean}
	 */
	public static DynaBean create(Class<?> beanClass, Object... params){
		return new DynaBean(beanClass, params);
	}

	//------------------------------------------------------------------------ Constructor start
	/**
	 * 构造
	 * @param beanClass Bean类
	 * @param params 构造Bean所需要的参数
	 */
	public DynaBean(Class<?> beanClass, Object... params){
		this(ReflectUtil.newInstance(beanClass, params));
	}

	/**
	 * 构造
	 * @param bean 原始Bean
	 */
	public DynaBean(Object bean){
		Assert.notNull(bean);
		if(bean instanceof DynaBean){
			bean = ((DynaBean)bean).getBean();
		}
		this.bean = bean;
		this.beanClass = ClassUtil.getClass(bean);
	}
	//------------------------------------------------------------------------ Constructor end

	/**
	 * 获得字段对应值
	 * @param <T> 属性值类型
	 * @param fieldName 字段名
	 * @return 字段值
	 * @throws BeanException 反射获取属性值或字段值导致的异常
	 */
	@SuppressWarnings("unchecked")
	public <T> T get(String fieldName) throws BeanException{
		if(Map.class.isAssignableFrom(beanClass)){
			return (T) ((Map<?, ?>)bean).get(fieldName);
		}else{
			try {
				final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
				if(null == method){
					throw new BeanException("No get method for {}", fieldName);
				}
				return (T) method.invoke(this.bean);
			} catch (Exception e) {
				throw new BeanException(e);
			}
		}
	}

	/**
	 * 获得字段对应值,获取异常返回{@code null}
	 *
	 * @param <T> 属性值类型
	 * @param fieldName 字段名
	 * @return 字段值
	 * @since 3.1.1
	 */
	public <T> T safeGet(String fieldName){
		try {
			return get(fieldName);
		} catch (Exception e) {
			return null;
		}
	}

	/**
	 * 设置字段值
	 * @param fieldName 字段名
	 * @param value 字段值
	 * @throws BeanException 反射获取属性值或字段值导致的异常
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void set(String fieldName, Object value) throws BeanException{
		if(Map.class.isAssignableFrom(beanClass)){
			((Map)bean).put(fieldName, value);
		}else{
			try {
				final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
				if(null == setter){
					throw new BeanException("No set method for {}", fieldName);
				}
				setter.invoke(this.bean, value);
			} catch (Exception e) {
				throw new BeanException(e);
			}
		}
	}

	/**
	 * 执行原始Bean中的方法
	 * @param methodName 方法名
	 * @param params 参数
	 * @return 执行结果,可能为null
	 */
	public Object invoke(String methodName, Object... params){
		return ReflectUtil.invoke(this.bean, methodName, params);
	}

	/**
	 * 获得原始Bean
	 * @param <T> Bean类型
	 * @return bean
	 */
	@SuppressWarnings("unchecked")
	public <T> T getBean(){
		return (T)this.bean;
	}

	/**
	 * 获得Bean的类型
	 * @param <T> Bean类型
	 * @return Bean类型
	 */
	@SuppressWarnings("unchecked")
	public <T> Class<T> getBeanClass(){
		return (Class<T>) this.beanClass;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((bean == null) ? 0 : bean.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final DynaBean other = (DynaBean) obj;
		if (bean == null) {
			return other.bean == null;
		} else return bean.equals(other.bean);
	}

	@Override
	public String toString() {
		return this.bean.toString();
	}
}


text: module.exports = require('./configs/karma.conf.js');

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Value Matching in H2O — h2o.match • h2o</title>

<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cosmo/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">

<link href="../pkgdown.css" rel="stylesheet">

  <link href="../extra.css" rel="stylesheet">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">

      </button>
      H2O.ai

  The H2O-R Package

  Getting Started

  R Reference Guide

Value Matching in H2O

match and %in% return values similar to the base R generic
functions.

h2o.match(x, table, nomatch = 0, incomparables = NULL)

match.H2OFrame(x, table, nomatch = 0, incomparables = NULL)

x %in% table

 Arguments

    <colgroup><col class="name" /><col class="desc" /></colgroup>

      x

a categorical vector from an H2OFrame object with
values to be matched.

      table

an R object to match x against.

      nomatch

the value to be returned in the case when no match is found.

      incomparables

a vector of calues that cannot be matched. Any value in
x matching a value in this vector is assigned the
nomatch value.

Value

Returns a vector of the positions of (first) matches of its first argument in its second

See also

match for base R implementation.

Examples

# NOT RUN {
h2o.init()
hex <- as.h2o(iris)
h2o.match(hex[,5], c("setosa", "versicolor"))
# }

Contents

Arguments

Value

See also

Examples

Developed by The H2O.ai team.

Site built with pkgdown.


text:
<?php

namespace CG\Tests\Proxy\Fixture;

interface SluggableInterface
{
    function getSlug();
}


text:
function update_options_for(id, json) {
    $(id).empty();
    $(id).append("<option SELECTED value=''></option>");
    $.each(json, function(i, n){
        $(id).append('<option value="'+ n.k + '">' + n.v + "</option>");
    });
}

function ajax_request(data, on_success) {
    $.ajax({
            type: "GET",
            url: "ajax/aj_data_request.cgi",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: data,
            success: on_success
        });
}


text:
@interface CardView : UIView

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE component SYSTEM "../misc/component.dtd" [
<!ENTITY standard_uicomponent_attributes		SYSTEM "../entities/standard_uicomponent_attributes.xml">
<!ENTITY widget_var_attribute					SYSTEM "../entities/widget_var_attribute.xml">
]>
<component>
	<tag>overlayPanel</tag>
	<tagClass>org.primefaces.component.overlaypanel.OverlayPanelTag</tagClass>
	<componentClass>org.primefaces.component.overlaypanel.OverlayPanel</componentClass>
	<componentType>org.primefaces.component.OverlayPanel</componentType>
	<componentFamily>org.primefaces.component</componentFamily>
	<rendererType>org.primefaces.component.OverlayPanelRenderer</rendererType>
	<rendererClass>org.primefaces.component.overlaypanel.OverlayPanelRenderer</rendererClass>
	<parent>javax.faces.component.UIPanel</parent>
    <description>OverlayPanel is a generic container component that is displayed as a popup.</description>
    <interfaces>
		<interface>
			<name>org.primefaces.component.api.Widget</name>
		</interface>
	</interfaces>
    <attributes>
		&standard_uicomponent_attributes;
        &widget_var_attribute;
		<attribute>
			<name>style</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Inline style of the component.</description>
		</attribute>
		<attribute>
			<name>styleClass</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Style class of the component.</description>
		</attribute>
		<attribute>
			<name>for</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Identifier of the target component to show the panel.</description>
		</attribute>
        <attribute>
			<name>showEvent</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Event to show the overlay panel, default is "click".</description>
		</attribute>
        <attribute>
			<name>hideEvent</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Event to hide the overlay panel, default is "click".</description>
		</attribute>
        <attribute>
			<name>showEffect</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Effect to display when showing the panel.</description>
		</attribute>
        <attribute>
			<name>hideEffect</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Effect to display when hiding the panel.</description>
		</attribute>
        <attribute>
			<name>appendToBody</name>
			<required>false</required>
			<type>java.lang.Boolean</type>
            <defaultValue>false</defaultValue>
            <description>When set true, panel is appended as a child of document body.</description>
		</attribute>
        <attribute>
            <name>onShow</name>
            <required>false</required>
            <type>java.lang.String</type>
            <description>Client side callback to execute when panel is displayed.</description>
        </attribute>
        <attribute>
            <name>onHide</name>
            <required>false</required>
            <type>java.lang.String</type>
            <description>Client side callback to execute when panel is hidden.</description>
        </attribute>
        <attribute>
            <name>my</name>
            <required>false</required>
            <type>java.lang.String</type>
            <description>Position of the panel relative to the target.</description>
        </attribute>
        <attribute>
            <name>at</name>
            <required>false</required>
            <type>java.lang.String</type>
            <description>Position of the target relative to the panel.</description>
        </attribute>
        <attribute>
            <name>dynamic</name>
            <required>false</required>
            <type>java.lang.Boolean</type>
            <defaultValue>false</defaultValue>
            <description>Dynamic mode allows overlay panel to fetch it's contents before it's shown rather than on page load
            which is useful to reduce initial page load times. Default is false.</description>
        </attribute>
        <attribute>
			<name>dismissable</name>
			<required>false</required>
			<type>java.lang.Boolean</type>
            <defaultValue>true</defaultValue>
            <description>When set true, clicking outside of the panel hides the overlay.</description>
		</attribute>
        <attribute>
			<name>showCloseIcon</name>
			<required>false</required>
			<type>java.lang.Boolean</type>
            <defaultValue>false</defaultValue>
            <description>Displays a close icon to hide the overlay, default is false.</description>
		</attribute>
	</attributes>
    <resources>
        <resource>
            <name>primefaces.css</name>
        </resource>
        <resource>
            <name>jquery/jquery.js</name>
        </resource>
        <resource>
			<name>jquery/jquery-plugins.js</name>
		</resource>
        <resource>
            <name>primefaces.js</name>
        </resource>
    </resources>
</component>


text:
SnapToRoadsResponse

      Field
      Required
      Type
      Description

          snappedPoints

      optional

        Array<SnappedPoint>

An array of snapped points.

            See SnappedPoint for more information.

          warningMessage

      optional
      string

A string containing a user-visible warning.

  Generated from the
  OpenAPI specification.
  edit Edit
  bug_report Report bug


text:
package org.apache.james.smtpserver.fastfail;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;

import java.util.Arrays;

public class SpamTrapHandler extends org.apache.james.protocols.smtp.core.fastfail.SpamTrapHandler implements InitializingLifecycleAwareProtocolHandler {

    @Override
    public void init(Configuration config) throws ConfigurationException {
        String[] rcpts = config.getStringArray("spamTrapRecip");

        if (rcpts.length == 0) {
            setSpamTrapRecipients(Arrays.asList(rcpts));
        } else {
            throw new ConfigurationException("Please configure a spamTrapRecip.");
        }

        setBlockTime(config.getLong("blockTime", blockTime));
    }

    @Override
    public void destroy() {
        // nothing to-do
    }
}


text:
package org.apache.commons.compress.archivers.arj;

import java.util.Arrays;
import java.util.Objects;

class LocalFileHeader {
    int archiverVersionNumber;
    int minVersionToExtract;
    int hostOS;
    int arjFlags;
    int method;
    int fileType;
    int reserved;
    int dateTimeModified;
    long compressedSize;
    long originalSize;
    long originalCrc32;
    int fileSpecPosition;
    int fileAccessMode;
    int firstChapter;
    int lastChapter;

    int extendedFilePosition;
    int dateTimeAccessed;
    int dateTimeCreated;
    int originalSizeEvenForVolumes;

    String name;
    String comment;

    byte[][] extendedHeaders;

    static class Flags {
        static final int GARBLED = 0x01;
        static final int VOLUME = 0x04;
        static final int EXTFILE = 0x08;
        static final int PATHSYM = 0x10;
        static final int BACKUP = 0x20;
    }

    static class FileTypes {
        static final int BINARY = 0;
        static final int SEVEN_BIT_TEXT = 1;
        static final int COMMENT_HEADER = 2;
        static final int DIRECTORY = 3;
        static final int VOLUME_LABEL = 4;
        static final int CHAPTER_LABEL = 5;
    }

    static class Methods {
        static final int STORED = 0;
        static final int COMPRESSED_MOST = 1;
        static final int COMPRESSED = 2;
        static final int COMPRESSED_FASTER = 3;
        static final int COMPRESSED_FASTEST = 4;
        static final int NO_DATA_NO_CRC = 8;
        static final int NO_DATA = 9;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder();
        builder.append("LocalFileHeader [archiverVersionNumber=");
        builder.append(archiverVersionNumber);
        builder.append(", minVersionToExtract=");
        builder.append(minVersionToExtract);
        builder.append(", hostOS=");
        builder.append(hostOS);
        builder.append(", arjFlags=");
        builder.append(arjFlags);
        builder.append(", method=");
        builder.append(method);
        builder.append(", fileType=");
        builder.append(fileType);
        builder.append(", reserved=");
        builder.append(reserved);
        builder.append(", dateTimeModified=");
        builder.append(dateTimeModified);
        builder.append(", compressedSize=");
        builder.append(compressedSize);
        builder.append(", originalSize=");
        builder.append(originalSize);
        builder.append(", originalCrc32=");
        builder.append(originalCrc32);
        builder.append(", fileSpecPosition=");
        builder.append(fileSpecPosition);
        builder.append(", fileAccessMode=");
        builder.append(fileAccessMode);
        builder.append(", firstChapter=");
        builder.append(firstChapter);
        builder.append(", lastChapter=");
        builder.append(lastChapter);
        builder.append(", extendedFilePosition=");
        builder.append(extendedFilePosition);
        builder.append(", dateTimeAccessed=");
        builder.append(dateTimeAccessed);
        builder.append(", dateTimeCreated=");
        builder.append(dateTimeCreated);
        builder.append(", originalSizeEvenForVolumes=");
        builder.append(originalSizeEvenForVolumes);
        builder.append(", name=");
        builder.append(name);
        builder.append(", comment=");
        builder.append(comment);
        builder.append(", extendedHeaders=");
        builder.append(Arrays.toString(extendedHeaders));
        builder.append("]");
        return builder.toString();
    }

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

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        final LocalFileHeader other = (LocalFileHeader) obj;
        return
            archiverVersionNumber == other.archiverVersionNumber &&
            minVersionToExtract == other.minVersionToExtract &&
            hostOS == other.hostOS &&
            arjFlags == other.arjFlags &&
            method == other.method &&
            fileType == other.fileType &&
            reserved == other.reserved &&
            dateTimeModified == other.dateTimeModified &&
            compressedSize == other.compressedSize &&
            originalSize == other.originalSize &&
            originalCrc32 == other.originalCrc32 &&
            fileSpecPosition == other.fileSpecPosition &&
            fileAccessMode == other.fileAccessMode &&
            firstChapter == other.firstChapter &&
            lastChapter == other.lastChapter &&
            extendedFilePosition == other.extendedFilePosition &&
            dateTimeAccessed == other.dateTimeAccessed &&
            dateTimeCreated == other.dateTimeCreated &&
            originalSizeEvenForVolumes == other.originalSizeEvenForVolumes &&
            Objects.equals(name, other.name) &&
            Objects.equals(comment, other.comment) &&
            Arrays.deepEquals(extendedHeaders, other.extendedHeaders);
    }

}


text:
name: cljs.core/comment
see also:
---

## Summary

## Details

Ignores all `body` forms (i.e. "commenting out"). Returns nil.

This is often used near the bottom of a file to hold expressions that test
different functions during development.  Specific expressions within the
`comment` can then be selected and evaluated from some editors.

You can also use `;` to "comment out" code until the end of a line.

## Examples

```clj
(comment 123)
;;=> nil

(comment
  (foo 1 2 3)
  (bar "hello"))
;;=> nil
```

Inner forms must still be syntactically correct:

```clj
(comment [1 2 3]])
;; Error: Unmatched delimiter ]

(comment a : b)
;; Error: Invalid token :
```


text:
package kerio.connect.admin.domains;

public class MaximumUsers {

  boolean        isUnlimited;      ///< is it a special case with no limit for users ?
  long        allowedUsers;     ///< number of allowed users (take minimum of server and domain limit)
  long            limit;           ///< max. user limit
  UserLimitType  limitType;

  public MaximumUsers() {

  }

  public boolean isIsUnlimited() {
    return isUnlimited;
  }

  public void setIsUnlimited(boolean isUnlimited) {
    this.isUnlimited = isUnlimited;
  }

  public long getAllowedUsers() {
    return allowedUsers;
  }

  public void setAllowedUsers(long allowedUsers) {
    this.allowedUsers = allowedUsers;
  }

  public long getLimit() {
    return limit;
  }

  public void setLimit(long limit) {
    this.limit = limit;
  }

  public UserLimitType getLimitType() {
    return limitType;
  }

  public void setLimitType(UserLimitType limitType) {
    this.limitType = limitType;
  }

  enum UserLimitType {
    DomainLimit,   ///< stricter limit for amount of users is on domain
    LicenseLimit   ///< stricter limit for amount of users is on license
  }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Zheng & Chen, Mycotaxon 80: 56 (2001)

#### Original name
Cunninghamella septata R.Y. Zheng

### Remarks
null


text:
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`


text:
<?php

/**
 * Description of ContactDaoMysql
 *
 * @author Daniele Ambrosino
 */
class ContactDaoMysql extends ContactDao
{

  /**
   *
   * @param Contact $message
   */
  public function store($message)
  {
    $this->db->query('START TRANSACTION');
    $id = $this->storeMessageByType($message, 'contact');
    $query = "INSERT INTO Contacts (messageId, phoneNumber, firstName, lastName, userId, vcard) VALUES (?, ?, ?, ?, ?, ?)";
    $values = [$id, $message->getPhoneNumber(), $message->getFirstName(), $message->getLastName(), $message->getUserId(), $message->getVcard()];
    $this->db->query($query, $values);
    $this->db->query('COMMIT');
  }

}


text:
namespace OpenHome {
namespace Net {

class SyncReadLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncReadLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, Brh& aaBuffer);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
    Brh& iaBuffer;
};

class SyncWriteLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncWriteLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
};

class SyncEraseLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncEraseLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
};

class SyncEraseSectorLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncEraseSectorLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
};

class SyncEraseSectorsLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncEraseSectorsLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
};

class SyncEraseChipLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncEraseChipLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
};

class SyncSectorsLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncSectorsLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaSectors);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
    TUint& iaSectors;
};

class SyncSectorBytesLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncSectorBytesLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaBytes);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
    TUint& iaBytes;
};

class SyncRomDirInfoLinnCoUkFlash1 : public SyncProxyAction
{
public:
    SyncRomDirInfoLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaFlashIdMain, TUint& aaOffsetMain, TUint& aaBytesMain, TUint& aaFlashIdFallback, TUint& aaOffsetFallback, TUint& aaBytesFallback);
    virtual void CompleteRequest(IAsync& aAsync);
private:
    CpProxyLinnCoUkFlash1& iService;
    TUint& iaFlashIdMain;
    TUint& iaOffsetMain;
    TUint& iaBytesMain;
    TUint& iaFlashIdFallback;
    TUint& iaOffsetFallback;
    TUint& iaBytesFallback;
};

} // namespace Net
} // namespace OpenHome

using namespace OpenHome;
using namespace OpenHome::Net;

// SyncReadLinnCoUkFlash1

SyncReadLinnCoUkFlash1::SyncReadLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, Brh& aaBuffer)
    : iService(aProxy)
    , iaBuffer(aaBuffer)
{
}

void SyncReadLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndRead(aAsync, iaBuffer);
}

// SyncWriteLinnCoUkFlash1

SyncWriteLinnCoUkFlash1::SyncWriteLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy)
    : iService(aProxy)
{
}

void SyncWriteLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndWrite(aAsync);
}

// SyncEraseLinnCoUkFlash1

SyncEraseLinnCoUkFlash1::SyncEraseLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy)
    : iService(aProxy)
{
}

void SyncEraseLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndErase(aAsync);
}

// SyncEraseSectorLinnCoUkFlash1

SyncEraseSectorLinnCoUkFlash1::SyncEraseSectorLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy)
    : iService(aProxy)
{
}

void SyncEraseSectorLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndEraseSector(aAsync);
}

// SyncEraseSectorsLinnCoUkFlash1

SyncEraseSectorsLinnCoUkFlash1::SyncEraseSectorsLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy)
    : iService(aProxy)
{
}

void SyncEraseSectorsLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndEraseSectors(aAsync);
}

// SyncEraseChipLinnCoUkFlash1

SyncEraseChipLinnCoUkFlash1::SyncEraseChipLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy)
    : iService(aProxy)
{
}

void SyncEraseChipLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndEraseChip(aAsync);
}

// SyncSectorsLinnCoUkFlash1

SyncSectorsLinnCoUkFlash1::SyncSectorsLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaSectors)
    : iService(aProxy)
    , iaSectors(aaSectors)
{
}

void SyncSectorsLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndSectors(aAsync, iaSectors);
}

// SyncSectorBytesLinnCoUkFlash1

SyncSectorBytesLinnCoUkFlash1::SyncSectorBytesLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaBytes)
    : iService(aProxy)
    , iaBytes(aaBytes)
{
}

void SyncSectorBytesLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndSectorBytes(aAsync, iaBytes);
}

// SyncRomDirInfoLinnCoUkFlash1

SyncRomDirInfoLinnCoUkFlash1::SyncRomDirInfoLinnCoUkFlash1(CpProxyLinnCoUkFlash1& aProxy, TUint& aaFlashIdMain, TUint& aaOffsetMain, TUint& aaBytesMain, TUint& aaFlashIdFallback, TUint& aaOffsetFallback, TUint& aaBytesFallback)
    : iService(aProxy)
    , iaFlashIdMain(aaFlashIdMain)
    , iaOffsetMain(aaOffsetMain)
    , iaBytesMain(aaBytesMain)
    , iaFlashIdFallback(aaFlashIdFallback)
    , iaOffsetFallback(aaOffsetFallback)
    , iaBytesFallback(aaBytesFallback)
{
}

void SyncRomDirInfoLinnCoUkFlash1::CompleteRequest(IAsync& aAsync)
{
    iService.EndRomDirInfo(aAsync, iaFlashIdMain, iaOffsetMain, iaBytesMain, iaFlashIdFallback, iaOffsetFallback, iaBytesFallback);
}

// CpProxyLinnCoUkFlash1

CpProxyLinnCoUkFlash1::CpProxyLinnCoUkFlash1(CpDevice& aDevice)
    : iCpProxy("linn-co-uk", "Flash", 1, aDevice.Device())
{
    OpenHome::Net::Parameter* param;

    iActionRead = new Action("Read");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionRead->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aAddress");
    iActionRead->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aLength");
    iActionRead->AddInputParameter(param);
    param = new OpenHome::Net::ParameterBinary("aBuffer");
    iActionRead->AddOutputParameter(param);

    iActionWrite = new Action("Write");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionWrite->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aAddress");
    iActionWrite->AddInputParameter(param);
    param = new OpenHome::Net::ParameterBinary("aSource");
    iActionWrite->AddInputParameter(param);

    iActionErase = new Action("Erase");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionErase->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aAddress");
    iActionErase->AddInputParameter(param);

    iActionEraseSector = new Action("EraseSector");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionEraseSector->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aSector");
    iActionEraseSector->AddInputParameter(param);

    iActionEraseSectors = new Action("EraseSectors");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionEraseSectors->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aFirstSector");
    iActionEraseSectors->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aLastSector");
    iActionEraseSectors->AddInputParameter(param);

    iActionEraseChip = new Action("EraseChip");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionEraseChip->AddInputParameter(param);

    iActionSectors = new Action("Sectors");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionSectors->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aSectors");
    iActionSectors->AddOutputParameter(param);

    iActionSectorBytes = new Action("SectorBytes");
    param = new OpenHome::Net::ParameterUint("aId");
    iActionSectorBytes->AddInputParameter(param);
    param = new OpenHome::Net::ParameterUint("aBytes");
    iActionSectorBytes->AddOutputParameter(param);

    iActionRomDirInfo = new Action("RomDirInfo");
    param = new OpenHome::Net::ParameterUint("aFlashIdMain");
    iActionRomDirInfo->AddOutputParameter(param);
    param = new OpenHome::Net::ParameterUint("aOffsetMain");
    iActionRomDirInfo->AddOutputParameter(param);
    param = new OpenHome::Net::ParameterUint("aBytesMain");
    iActionRomDirInfo->AddOutputParameter(param);
    param = new OpenHome::Net::ParameterUint("aFlashIdFallback");
    iActionRomDirInfo->AddOutputParameter(param);
    param = new OpenHome::Net::ParameterUint("aOffsetFallback");
    iActionRomDirInfo->AddOutputParameter(param);
    param = new OpenHome::Net::ParameterUint("aBytesFallback");
    iActionRomDirInfo->AddOutputParameter(param);
}

CpProxyLinnCoUkFlash1::~CpProxyLinnCoUkFlash1()
{
    DestroyService();
    delete iActionRead;
    delete iActionWrite;
    delete iActionErase;
    delete iActionEraseSector;
    delete iActionEraseSectors;
    delete iActionEraseChip;
    delete iActionSectors;
    delete iActionSectorBytes;
    delete iActionRomDirInfo;
}

void CpProxyLinnCoUkFlash1::SyncRead(TUint aaId, TUint aaAddress, TUint aaLength, Brh& aaBuffer)
{
    SyncReadLinnCoUkFlash1 sync(*this, aaBuffer);
    BeginRead(aaId, aaAddress, aaLength, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginRead(TUint aaId, TUint aaAddress, TUint aaLength, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionRead, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionRead->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaAddress));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaLength));
    TUint outIndex = 0;
    const Action::VectorParameters& outParams = iActionRead->OutputParameters();
    invocation->AddOutput(new ArgumentBinary(*outParams[outIndex++]));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndRead(IAsync& aAsync, Brh& aaBuffer)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("Read"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
    TUint index = 0;
    ((ArgumentBinary*)invocation.OutputArguments()[index++])->TransferTo(aaBuffer);
}

void CpProxyLinnCoUkFlash1::SyncWrite(TUint aaId, TUint aaAddress, const Brx& aaSource)
{
    SyncWriteLinnCoUkFlash1 sync(*this);
    BeginWrite(aaId, aaAddress, aaSource, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginWrite(TUint aaId, TUint aaAddress, const Brx& aaSource, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionWrite, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionWrite->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaAddress));
    invocation->AddInput(new ArgumentBinary(*inParams[inIndex++], aaSource));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndWrite(IAsync& aAsync)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("Write"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
}

void CpProxyLinnCoUkFlash1::SyncErase(TUint aaId, TUint aaAddress)
{
    SyncEraseLinnCoUkFlash1 sync(*this);
    BeginErase(aaId, aaAddress, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginErase(TUint aaId, TUint aaAddress, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionErase, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionErase->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaAddress));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndErase(IAsync& aAsync)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("Erase"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
}

void CpProxyLinnCoUkFlash1::SyncEraseSector(TUint aaId, TUint aaSector)
{
    SyncEraseSectorLinnCoUkFlash1 sync(*this);
    BeginEraseSector(aaId, aaSector, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginEraseSector(TUint aaId, TUint aaSector, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionEraseSector, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionEraseSector->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaSector));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndEraseSector(IAsync& aAsync)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("EraseSector"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
}

void CpProxyLinnCoUkFlash1::SyncEraseSectors(TUint aaId, TUint aaFirstSector, TUint aaLastSector)
{
    SyncEraseSectorsLinnCoUkFlash1 sync(*this);
    BeginEraseSectors(aaId, aaFirstSector, aaLastSector, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginEraseSectors(TUint aaId, TUint aaFirstSector, TUint aaLastSector, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionEraseSectors, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionEraseSectors->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaFirstSector));
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaLastSector));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndEraseSectors(IAsync& aAsync)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("EraseSectors"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
}

void CpProxyLinnCoUkFlash1::SyncEraseChip(TUint aaId)
{
    SyncEraseChipLinnCoUkFlash1 sync(*this);
    BeginEraseChip(aaId, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginEraseChip(TUint aaId, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionEraseChip, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionEraseChip->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndEraseChip(IAsync& aAsync)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("EraseChip"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
}

void CpProxyLinnCoUkFlash1::SyncSectors(TUint aaId, TUint& aaSectors)
{
    SyncSectorsLinnCoUkFlash1 sync(*this, aaSectors);
    BeginSectors(aaId, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginSectors(TUint aaId, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionSectors, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionSectors->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    TUint outIndex = 0;
    const Action::VectorParameters& outParams = iActionSectors->OutputParameters();
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndSectors(IAsync& aAsync, TUint& aaSectors)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("Sectors"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
    TUint index = 0;
    aaSectors = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
}

void CpProxyLinnCoUkFlash1::SyncSectorBytes(TUint aaId, TUint& aaBytes)
{
    SyncSectorBytesLinnCoUkFlash1 sync(*this, aaBytes);
    BeginSectorBytes(aaId, sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginSectorBytes(TUint aaId, FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionSectorBytes, aFunctor);
    TUint inIndex = 0;
    const Action::VectorParameters& inParams = iActionSectorBytes->InputParameters();
    invocation->AddInput(new ArgumentUint(*inParams[inIndex++], aaId));
    TUint outIndex = 0;
    const Action::VectorParameters& outParams = iActionSectorBytes->OutputParameters();
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndSectorBytes(IAsync& aAsync, TUint& aaBytes)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("SectorBytes"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
    TUint index = 0;
    aaBytes = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
}

void CpProxyLinnCoUkFlash1::SyncRomDirInfo(TUint& aaFlashIdMain, TUint& aaOffsetMain, TUint& aaBytesMain, TUint& aaFlashIdFallback, TUint& aaOffsetFallback, TUint& aaBytesFallback)
{
    SyncRomDirInfoLinnCoUkFlash1 sync(*this, aaFlashIdMain, aaOffsetMain, aaBytesMain, aaFlashIdFallback, aaOffsetFallback, aaBytesFallback);
    BeginRomDirInfo(sync.Functor());
    sync.Wait();
}

void CpProxyLinnCoUkFlash1::BeginRomDirInfo(FunctorAsync& aFunctor)
{
    Invocation* invocation = iCpProxy.GetService().Invocation(*iActionRomDirInfo, aFunctor);
    TUint outIndex = 0;
    const Action::VectorParameters& outParams = iActionRomDirInfo->OutputParameters();
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    invocation->AddOutput(new ArgumentUint(*outParams[outIndex++]));
    iCpProxy.GetInvocable().InvokeAction(*invocation);
}

void CpProxyLinnCoUkFlash1::EndRomDirInfo(IAsync& aAsync, TUint& aaFlashIdMain, TUint& aaOffsetMain, TUint& aaBytesMain, TUint& aaFlashIdFallback, TUint& aaOffsetFallback, TUint& aaBytesFallback)
{
    ASSERT(((Async&)aAsync).Type() == Async::eInvocation);
    Invocation& invocation = (Invocation&)aAsync;
    ASSERT(invocation.Action().Name() == Brn("RomDirInfo"));

    Error::ELevel level;
    TUint code;
    const TChar* ignore;
    if (invocation.Error(level, code, ignore)) {
        THROW_PROXYERROR(level, code);
    }
    TUint index = 0;
    aaFlashIdMain = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
    aaOffsetMain = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
    aaBytesMain = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
    aaFlashIdFallback = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
    aaOffsetFallback = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
    aaBytesFallback = ((ArgumentUint*)invocation.OutputArguments()[index++])->Value();
}

void CpProxyLinnCoUkFlash1::Subscribe()
{
  iCpProxy.Subscribe();
}

void CpProxyLinnCoUkFlash1::Unsubscribe()
{
 iCpProxy.Unsubscribe();
}

void CpProxyLinnCoUkFlash1::SetPropertyChanged(Functor& aFunctor)
{
  iCpProxy.SetPropertyChanged(aFunctor);
}

void CpProxyLinnCoUkFlash1::SetPropertyInitialEvent(Functor& aFunctor)
{
  iCpProxy.SetPropertyInitialEvent(aFunctor);
}
void CpProxyLinnCoUkFlash1::AddProperty(Property* aProperty)
{
  iCpProxy.AddProperty(aProperty);
}

void CpProxyLinnCoUkFlash1::DestroyService()
{
  iCpProxy.DestroyService();
}

void CpProxyLinnCoUkFlash1::ReportEvent(Functor aFunctor)
{
  iCpProxy.ReportEvent(aFunctor);
}

TUint CpProxyLinnCoUkFlash1::Version() const
{
  return iCpProxy.Version();
}


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

// inline help html. Only 'help_body' is used.
$lang['help_body'] = "

Áttekintés

	A Blog modul egy egyszerű eszköz a bejegyzések publikálására.

Kategóriák

	Számtalan kategóriát lehet létrehozni a bejegyzések rendezésére. Ha szeretnéd, hogy a látogatók
	kategória alapján is tudjanak böngészni, egyszerűen építs be egy Blog-kategória widgetet az oldalba.

Bejegyzések

	Válassz egy jó címet a bejegyzéshez, ami a blog főoldalán jelenjen meg (bevezetővel együtt) és
	ami a keresőmotorok találatai között címként szerepeljen. Miután a bejegyzést létrehoztad, azonnal publikálhatod vagy
	elmentheted piszkozatként is, ha később vissza akarnál jönni szerkeszteni. A bejegyzést élővé lehet tenni úgy is, hogy
        csak egy beállított időtől kezdve jelenjen meg - addig nem.

";

/* End of file help_lang.php */


text:
layout: post
title:  "Creating many (really many) users in PostgreSQL"
author: Luca Ferrari
tags:
- postgresql
- planet-postgresql-org
permalink: /:year/:month/:day/:title.html
---

PostgreSQL can really handle a lot of database users (*roles*), and it is possible to stress the system in a very simple way.

# Creating many (*really many*) users in PostgreSQL

In his post [Hans-Jürgen Schönig showed how to easily and quickly create a million users in PostgreSQL](https://www.cybertec-postgresql.com/en/creating-1-million-users-in-postgresql/); taking inspiration from such post, I decided to stress one of my virtual machines with a little more complex user creation use-case.

## Roles in Roles

One feature of PostgreSQL *roles* is that they can contain other roles, creating a hierarchy of roles. Therefore, I decided to write a simple `plpgsql` function to loop creating a chain of roles at each iteration. The function `f_users` accepts two integers:
- `deep` is the number of roles within the single role inheritance chain;
- `how_many` is the number of iterations.

As a result, the procedure will create `( 1 + deep ) x how_many` roles. Each role name is made by a random string and the iteration number, therefore preventing as much as possible collisions.

The function code is as follows:

```sql
CREATE OR REPLACE FUNCTION f_users( deep int, how_many int )
RETURNS VOID
AS
$BODY$
DECLARE
        main_role_name     text;
        current_role_name  text;
        current_level      int;
        iteration          int;
        query              text;
BEGIN

<<LP_MAIN>>
 FOR iteration IN 1..how_many LOOP
     -- main role
     main_role_name := 'role_test_' || md5( random()::text ) || '_' || iteration;
     RAISE DEBUG 'Main role is %', main_role_name;
     query := 'CREATE ROLE ' || main_role_name || ' WITH NOLOGIN CONNECTION LIMIT 0;';
     RAISE DEBUG '%', query;
     EXECUTE query;

     <<LP_DEEP>>
       FOR current_level IN 1..deep BY 1 LOOP
        current_role_name := main_role_name || '_' || current_level;
        RAISE DEBUG 'Level % -> role %', current_level, current_role_name;
        query := 'CREATE ROLE ' || current_role_name || ' WITH IN ROLE ' || main_role_name ||  ' NOLOGIN CONNECTION LIMIT 0;';
        RAISE DEBUG '%', query;
        EXECUTE query;
      END LOOP LP_DEEP;
 END LOOP LP_MAIN;

END;
$BODY$
LANGUAGE plpgsql;
```

Please note the above code can be optimized reducing the number of `RAISE` (that implies string concatenation).
The `connection limit 0` is for safety reasons: it is not desiderable to have such automatically created roles to be of any practical use.

## Results

The first attempt was short and sweet: 5000 roles within 1000 groups.

```sql
# SELECT f_users( 5, 1000 );
 f_users
---------

(1 row)

Time: 965.479 ms
```

As readers can see, this took less than a second to perform. What about a 10x factor?

```sql
# SELECT f_users( 5, 10000 );
 f_users
---------

(1 row)

Time: 9118.100 ms
```

It seems time is growing linearly.
Increase by a 5x factor:

```sql
# SELECT f_users( 5, 50000 );
 f_users
---------

(1 row)

Time: 104680.382 ms
```

To recap, the following is the timing of role creations:

| Groups   | Levels   |         ROLES |        TIME |
|:--------:| -------- |:-------------:|------------:|
| 1000     |    5     | 6000          | 1 sec       |
|          |    2     | 3000          | 0.3 sec     |
| 10000    |    5     | 60000         | 10 sec      |
|          |    2     | 30000         | 2.7 sec     |
| 50000    |    5     | 300000        | 105 sec     |
|          |    2     | 150000        | 36 sec      |

*for a total of __549000__ roles in __155 secs__.*

So time is not really increasing linearly, but as readers can see PostgreSQL can easily handle a half million roles in less than three minutes.
What about the virtual machine? Well, it is a *poor* `FreeBSD 11.1-RELEASE` running PostgreSQL 9.6 with 512 MB of RAM without WAL archiving or any other replication active. I cannot hit one million roles in a single shoot in such machine because it starts swapping until the swap daemon freezes.

In order to confirm such, let's consider how many roles there are in my system:

```sql
# SELECT count(*) FROM pg_roles;
 count
--------
 552018
```

the final result is greater than what is expected because I had already a discrete amount of roles.

*Not so bad for a database!*


text:
namespace rocksdb {

class InternalKey;

// Value types encoded as the last component of internal keys.
// DO NOT CHANGE THESE ENUM VALUES: they are embedded in the on-disk
// data structures.
// The highest bit of the value type needs to be reserved to SST tables
// for them to do more flexible encoding.
enum ValueType : unsigned char {
  kTypeDeletion = 0x0,
  kTypeValue = 0x1,
  kTypeMerge = 0x2,
  kTypeLogData = 0x3,               // WAL only.
  kTypeColumnFamilyDeletion = 0x4,  // WAL only.
  kTypeColumnFamilyValue = 0x5,     // WAL only.
  kTypeColumnFamilyMerge = 0x6,     // WAL only.
  kTypeSingleDeletion = 0x7,
  kTypeColumnFamilySingleDeletion = 0x8,  // WAL only.
  kMaxValue = 0x7F                        // Not used for storing records.
};

// kValueTypeForSeek defines the ValueType that should be passed when
// constructing a ParsedInternalKey object for seeking to a particular
// sequence number (since we sort sequence numbers in decreasing order
// and the value type is embedded as the low 8 bits in the sequence
// number in internal keys, we need to use the highest-numbered
// ValueType, not the lowest).
static const ValueType kValueTypeForSeek = kTypeSingleDeletion;

// Checks whether a type is a value type (i.e. a type used in memtables and sst
// files).
inline bool IsValueType(ValueType t) {
  return t <= kTypeMerge || t == kTypeSingleDeletion;
}

// We leave eight bits empty at the bottom so a type and sequence#
// can be packed together into 64-bits.
static const SequenceNumber kMaxSequenceNumber =
    ((0x1ull << 56) - 1);

struct ParsedInternalKey {
  Slice user_key;
  SequenceNumber sequence;
  ValueType type;

  ParsedInternalKey() { }  // Intentionally left uninitialized (for speed)
  ParsedInternalKey(const Slice& u, const SequenceNumber& seq, ValueType t)
      : user_key(u), sequence(seq), type(t) { }
  std::string DebugString(bool hex = false) const;
};

// Return the length of the encoding of "key".
inline size_t InternalKeyEncodingLength(const ParsedInternalKey& key) {
  return key.user_key.size() + 8;
}

// Pack a sequence number and a ValueType into a uint64_t
extern uint64_t PackSequenceAndType(uint64_t seq, ValueType t);

// Given the result of PackSequenceAndType, store the sequence number in *seq
// and the ValueType in *t.
extern void UnPackSequenceAndType(uint64_t packed, uint64_t* seq, ValueType* t);

// Append the serialization of "key" to *result.
extern void AppendInternalKey(std::string* result,
                              const ParsedInternalKey& key);

// Attempt to parse an internal key from "internal_key".  On success,
// stores the parsed data in "*result", and returns true.
//
// On error, returns false, leaves "*result" in an undefined state.
extern bool ParseInternalKey(const Slice& internal_key,
                             ParsedInternalKey* result);

// Returns the user key portion of an internal key.
inline Slice ExtractUserKey(const Slice& internal_key) {
  assert(internal_key.size() >= 8);
  return Slice(internal_key.data(), internal_key.size() - 8);
}

inline ValueType ExtractValueType(const Slice& internal_key) {
  assert(internal_key.size() >= 8);
  const size_t n = internal_key.size();
  uint64_t num = DecodeFixed64(internal_key.data() + n - 8);
  unsigned char c = num & 0xff;
  return static_cast<ValueType>(c);
}

// A comparator for internal keys that uses a specified comparator for
// the user key portion and breaks ties by decreasing sequence number.
class InternalKeyComparator : public Comparator {
 private:
  const Comparator* user_comparator_;
  std::string name_;
 public:
  explicit InternalKeyComparator(const Comparator* c) : user_comparator_(c),
    name_("rocksdb.InternalKeyComparator:" +
          std::string(user_comparator_->Name())) {
  }
  virtual ~InternalKeyComparator() {}

  virtual const char* Name() const override;
  virtual int Compare(const Slice& a, const Slice& b) const override;
  virtual void FindShortestSeparator(std::string* start,
                                     const Slice& limit) const override;
  virtual void FindShortSuccessor(std::string* key) const override;

  const Comparator* user_comparator() const { return user_comparator_; }

  int Compare(const InternalKey& a, const InternalKey& b) const;
  int Compare(const ParsedInternalKey& a, const ParsedInternalKey& b) const;
};

// Modules in this directory should keep internal keys wrapped inside
// the following class instead of plain strings so that we do not
// incorrectly use string comparisons instead of an InternalKeyComparator.
class InternalKey {
 private:
  std::string rep_;
 public:
  InternalKey() { }   // Leave rep_ as empty to indicate it is invalid
  InternalKey(const Slice& _user_key, SequenceNumber s, ValueType t) {
    AppendInternalKey(&rep_, ParsedInternalKey(_user_key, s, t));
  }

  // sets the internal key to be bigger or equal to all internal keys with this
  // user key
  void SetMaxPossibleForUserKey(const Slice& _user_key) {
    AppendInternalKey(&rep_, ParsedInternalKey(_user_key, kMaxSequenceNumber,
                                               kValueTypeForSeek));
  }

  // sets the internal key to be smaller or equal to all internal keys with this
  // user key
  void SetMinPossibleForUserKey(const Slice& _user_key) {
    AppendInternalKey(
        &rep_, ParsedInternalKey(_user_key, 0, static_cast<ValueType>(0)));
  }

  bool Valid() const {
    ParsedInternalKey parsed;
    return ParseInternalKey(Slice(rep_), &parsed);
  }

  void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); }
  Slice Encode() const {
    assert(!rep_.empty());
    return rep_;
  }

  Slice user_key() const { return ExtractUserKey(rep_); }
  size_t size() { return rep_.size(); }

  void SetFrom(const ParsedInternalKey& p) {
    rep_.clear();
    AppendInternalKey(&rep_, p);
  }

  void Clear() { rep_.clear(); }

  std::string DebugString(bool hex = false) const;
};

inline int InternalKeyComparator::Compare(
    const InternalKey& a, const InternalKey& b) const {
  return Compare(a.Encode(), b.Encode());
}

inline bool ParseInternalKey(const Slice& internal_key,
                             ParsedInternalKey* result) {
  const size_t n = internal_key.size();
  if (n < 8) return false;
  uint64_t num = DecodeFixed64(internal_key.data() + n - 8);
  unsigned char c = num & 0xff;
  result->sequence = num >> 8;
  result->type = static_cast<ValueType>(c);
  assert(result->type <= ValueType::kMaxValue);
  result->user_key = Slice(internal_key.data(), n - 8);
  return IsValueType(result->type);
}

// Update the sequence number in the internal key.
// Guarantees not to invalidate ikey.data().
inline void UpdateInternalKey(std::string* ikey, uint64_t seq, ValueType t) {
  size_t ikey_sz = ikey->size();
  assert(ikey_sz >= 8);
  uint64_t newval = (seq << 8) | t;

  // Note: Since C++11, strings are guaranteed to be stored contiguously and
  // string::operator[]() is guaranteed not to change ikey.data().
  EncodeFixed64(&(*ikey)[ikey_sz - 8], newval);
}

// Get the sequence number from the internal key
inline uint64_t GetInternalKeySeqno(const Slice& internal_key) {
  const size_t n = internal_key.size();
  assert(n >= 8);
  uint64_t num = DecodeFixed64(internal_key.data() + n - 8);
  return num >> 8;
}

// A helper class useful for DBImpl::Get()
class LookupKey {
 public:
  // Initialize *this for looking up user_key at a snapshot with
  // the specified sequence number.
  LookupKey(const Slice& _user_key, SequenceNumber sequence);

  ~LookupKey();

  // Return a key suitable for lookup in a MemTable.
  Slice memtable_key() const {
    return Slice(start_, static_cast<size_t>(end_ - start_));
  }

  // Return an internal key (suitable for passing to an internal iterator)
  Slice internal_key() const {
    return Slice(kstart_, static_cast<size_t>(end_ - kstart_));
  }

  // Return the user key
  Slice user_key() const {
    return Slice(kstart_, static_cast<size_t>(end_ - kstart_ - 8));
  }

 private:
  // We construct a char array of the form:
  //    klength  varint32               <-- start_
  //    userkey  char[klength]          <-- kstart_
  //    tag      uint64
  //                                    <-- end_
  // The array is a suitable MemTable key.
  // The suffix starting with "userkey" can be used as an InternalKey.
  const char* start_;
  const char* kstart_;
  const char* end_;
  char space_[200];      // Avoid allocation for short keys

  // No copying allowed
  LookupKey(const LookupKey&);
  void operator=(const LookupKey&);
};

inline LookupKey::~LookupKey() {
  if (start_ != space_) delete[] start_;
}

class IterKey {
 public:
  IterKey() : key_(space_), buf_size_(sizeof(space_)), key_size_(0) {}

  ~IterKey() { ResetBuffer(); }

  Slice GetKey() const { return Slice(key_, key_size_); }

  Slice GetUserKey() const {
    assert(key_size_ >= 8);
    return Slice(key_, key_size_ - 8);
  }

  size_t Size() const { return key_size_; }

  void Clear() { key_size_ = 0; }

  // Append "non_shared_data" to its back, from "shared_len"
  // This function is used in Block::Iter::ParseNextKey
  // shared_len: bytes in [0, shard_len-1] would be remained
  // non_shared_data: data to be append, its length must be >= non_shared_len
  void TrimAppend(const size_t shared_len, const char* non_shared_data,
                  const size_t non_shared_len) {
    assert(shared_len <= key_size_);

    size_t total_size = shared_len + non_shared_len;
    if (total_size <= buf_size_) {
      key_size_ = total_size;
    } else {
      // Need to allocate space, delete previous space
      char* p = new char[total_size];
      memcpy(p, key_, shared_len);

      if (key_ != space_) {
        delete[] key_;
      }

      key_ = p;
      key_size_ = total_size;
      buf_size_ = total_size;
    }

    memcpy(key_ + shared_len, non_shared_data, non_shared_len);
  }

  Slice SetKey(const Slice& key) {
    size_t size = key.size();
    EnlargeBufferIfNeeded(size);
    memcpy(key_, key.data(), size);
    key_size_ = size;
    return Slice(key_, key_size_);
  }

  // Copies the content of key, updates the reference to the user key in ikey
  // and returns a Slice referencing the new copy.
  Slice SetKey(const Slice& key, ParsedInternalKey* ikey) {
    size_t key_n = key.size();
    assert(key_n >= 8);
    SetKey(key);
    ikey->user_key = Slice(key_, key_n - 8);
    return Slice(key_, key_n);
  }

  // Update the sequence number in the internal key.  Guarantees not to
  // invalidate slices to the key (and the user key).
  void UpdateInternalKey(uint64_t seq, ValueType t) {
    assert(key_size_ >= 8);
    uint64_t newval = (seq << 8) | t;
    EncodeFixed64(&key_[key_size_ - 8], newval);
  }

  void SetInternalKey(const Slice& key_prefix, const Slice& user_key,
                      SequenceNumber s,
                      ValueType value_type = kValueTypeForSeek) {
    size_t psize = key_prefix.size();
    size_t usize = user_key.size();
    EnlargeBufferIfNeeded(psize + usize + sizeof(uint64_t));
    if (psize > 0) {
      memcpy(key_, key_prefix.data(), psize);
    }
    memcpy(key_ + psize, user_key.data(), usize);
    EncodeFixed64(key_ + usize + psize, PackSequenceAndType(s, value_type));
    key_size_ = psize + usize + sizeof(uint64_t);
  }

  void SetInternalKey(const Slice& user_key, SequenceNumber s,
                      ValueType value_type = kValueTypeForSeek) {
    SetInternalKey(Slice(), user_key, s, value_type);
  }

  void Reserve(size_t size) {
    EnlargeBufferIfNeeded(size);
    key_size_ = size;
  }

  void SetInternalKey(const ParsedInternalKey& parsed_key) {
    SetInternalKey(Slice(), parsed_key);
  }

  void SetInternalKey(const Slice& key_prefix,
                      const ParsedInternalKey& parsed_key_suffix) {
    SetInternalKey(key_prefix, parsed_key_suffix.user_key,
                   parsed_key_suffix.sequence, parsed_key_suffix.type);
  }

  void EncodeLengthPrefixedKey(const Slice& key) {
    auto size = key.size();
    EnlargeBufferIfNeeded(size + static_cast<size_t>(VarintLength(size)));
    char* ptr = EncodeVarint32(key_, static_cast<uint32_t>(size));
    memcpy(ptr, key.data(), size);
  }

 private:
  char* key_;
  size_t buf_size_;
  size_t key_size_;
  char space_[32];  // Avoid allocation for short keys

  void ResetBuffer() {
    if (key_ != space_) {
      delete[] key_;
      key_ = space_;
    }
    buf_size_ = sizeof(space_);
    key_size_ = 0;
  }

  // Enlarge the buffer size if needed based on key_size.
  // By default, static allocated buffer is used. Once there is a key
  // larger than the static allocated buffer, another buffer is dynamically
  // allocated, until a larger key buffer is requested. In that case, we
  // reallocate buffer and delete the old one.
  void EnlargeBufferIfNeeded(size_t key_size) {
    // If size is smaller than buffer size, continue using current buffer,
    // or the static allocated one, as default
    if (key_size > buf_size_) {
      // Need to enlarge the buffer.
      ResetBuffer();
      key_ = new char[key_size];
      buf_size_ = key_size;
    }
  }

  // No copying allowed
  IterKey(const IterKey&) = delete;
  void operator=(const IterKey&) = delete;
};

class InternalKeySliceTransform : public SliceTransform {
 public:
  explicit InternalKeySliceTransform(const SliceTransform* transform)
      : transform_(transform) {}

  virtual const char* Name() const override { return transform_->Name(); }

  virtual Slice Transform(const Slice& src) const override {
    auto user_key = ExtractUserKey(src);
    return transform_->Transform(user_key);
  }

  virtual bool InDomain(const Slice& src) const override {
    auto user_key = ExtractUserKey(src);
    return transform_->InDomain(user_key);
  }

  virtual bool InRange(const Slice& dst) const override {
    auto user_key = ExtractUserKey(dst);
    return transform_->InRange(user_key);
  }

  const SliceTransform* user_prefix_extractor() const { return transform_; }

 private:
  // Like comparator, InternalKeySliceTransform will not take care of the
  // deletion of transform_
  const SliceTransform* const transform_;
};

// Read record from a write batch piece from input.
// tag, column_family, key, value and blob are return values. Callers own the
// Slice they point to.
// Tag is defined as ValueType.
// input will be advanced to after the record.
extern Status ReadRecordFromWriteBatch(Slice* input, char* tag,
                                       uint32_t* column_family, Slice* key,
                                       Slice* value, Slice* blob);
}  // namespace rocksdb


text:
using Google.Cloud.EntityFrameworkCore.Spanner.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace Google.Cloud.EntityFrameworkCore.Spanner.Infrastructure
{
    /// <summary>
    /// Allows Spanner specific configuration to be performed on <see cref="DbContextOptions" />.
    /// </summary>
    public class SpannerDbContextOptionsBuilder
        : RelationalDbContextOptionsBuilder<SpannerDbContextOptionsBuilder, SpannerOptionsExtension>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SpannerDbContextOptionsBuilder" /> class.
        /// </summary>
        /// <param name="optionsBuilder"> The options builder. </param>
        public SpannerDbContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)
            : base(optionsBuilder)
        {
        }
    }
}


text:
package io.github.suxil.auth.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.suxil.auth.domain.UaaRolePermission;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 角色-权限信息 服务类 测试用例
 * </p>
 *
 * @author generate
 * @since 2020-01-01
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@Transactional
@ActiveProfiles({"dev"})
public class UaaRolePermissionServiceTest {

    @Autowired
    private UaaRolePermissionService uaaRolePermissionService;

    @Test
    @Rollback
    public void listTest() {
        Page<UaaRolePermission> page = new Page<>();
        page.setPages(0);
        page.setSize(10);

        QueryWrapper<UaaRolePermission> queryWrapper = new QueryWrapper<>();

        IPage<UaaRolePermission> pageResult = uaaRolePermissionService.page(page, queryWrapper);

        Assert.assertNotNull(pageResult);
    }

    @Test
    @Rollback
    public void loadTest() {
        String id = "";
        UaaRolePermission uaaRolePermission = uaaRolePermissionService.getById(id);

        Assert.assertNotNull(uaaRolePermission);
    }

    @Test
    @Rollback
    public void createTest() {
        UaaRolePermission uaaRolePermission = new UaaRolePermission();
        uaaRolePermissionService.saveOrUpdate(uaaRolePermission);

    }

    @Test
    @Rollback
    public void updateTest() {
        UaaRolePermission uaaRolePermission = new UaaRolePermission();
        uaaRolePermissionService.saveOrUpdate(uaaRolePermission);

    }

    @Test
    @Rollback
    public void deleteTest() {
        String id = "";
        uaaRolePermissionService.removeById(id);

    }

}


text:
import os
import unittest
import warnings

from vcr import VCR
from octokit import Octokit

# Turn off requests warnings about unsecure SSL requests since
# no real requests are happening in tests. Everything is routed to VCR afterall
warnings.simplefilter("ignore")

CASSETTES_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                              'cassettes')

vcr = VCR(
    record_mode='once',
    cassette_library_dir=CASSETTES_PATH,
)

class OctokitTestCase(unittest.TestCase):
    """Base test case for all of the octokit resources.
    """

    _multiprocess_can_split_ = True

    def setUp(self):
        """Setup client for all test cases.
        """
        self.hub = Octokit()


text:
'use strict';

var http = require('http');
var https = require('https');
var path = require('path');
var FormData = require('form-data');
var utils = require('./utils');
var Error = require('./Error');
var fs = require('fs');

var hasOwn = {}.hasOwnProperty;

// Provide extension mechanism for HelloSign Resource Sub-Classes
HelloSignResource.extend = utils.protoExtend;

// Expose method-creator & prepared (basic) methods
HelloSignResource.method = require('./HelloSignMethod');
HelloSignResource.BASIC_METHODS = require('./HelloSignMethod.basic');

/**
 * Encapsulates request logic for a HelloSign Resource
 */
function HelloSignResource(hellosign, urlData) {

    this._hellosign = hellosign;
    this._urlData = urlData || {};

    this.basePath = utils.makeURLInterpolator(hellosign.getApiField('basePath'));
    this.path = utils.makeURLInterpolator(this.path);

    if (this.includeBasic) {
        this.includeBasic.forEach(function(methodName) {
            this[methodName] = HelloSignResource.BASIC_METHODS[methodName];
        }, this);
    }

    this.initialize.apply(this, arguments);

}

HelloSignResource.prototype = {

    path: '',

    initialize: function() {},

    createFullPath: function(commandPath, urlData, oauthRequest) {

        var pathPrefix = oauthRequest === true ? "/" : this.basePath(urlData);

        return path.join(
            pathPrefix,
            this.path(urlData),
                typeof commandPath == 'function' ?
                commandPath(urlData) : commandPath
        ).replace(/\\/g, '/'); // ugly workaround for Windows
    },

    createUrlData: function() {
        var urlData = {};
        // Merge in baseData
        for (var i in this._urlData) {
            if (hasOwn.call(this._urlData, i)) {
                urlData[i] = this._urlData[i];
            }
        }
        return urlData;
    },

    createDeferred: function(callback) {
        return (() => {
            let resolve;
            let reject;

            let p = new Promise((res, rej) => {
                resolve = res;
                reject = rej;
            })

            if (callback) {
                // Callback, if provided, is a simply translated to Promise'esque:
                // (Ensure callback is called outside of promise stack)
                p.then(function(res) {
                    setTimeout(function(){
                        callback(null, res)
                    }, 0);
                }).catch(function(err) {
                    setTimeout(function(){
                        callback(err, null);
                    }, 0);
                });
            }

            return {
                promise: p,
                reject,
                resolve
            }
        })()
    },

    _timeoutHandler: function(timeout, req, callback) {
        var self = this;
        return function() {
            var timeoutErr = new Error('ETIMEDOUT');
            timeoutErr.code = 'ETIMEDOUT';

            req._isAborted = true;
            req.abort();

            callback.call(
                self,
                new Error.HelloSignConnectionError({
                    message: 'Request aborted due to timeout being reached (' + timeout + 'ms)',
                    detail: timeoutErr
                }),
                null
            );
        }
    },

    _responseHandler: function(req, callback) {

        var self = this;
        return function(res) {
            var resHeaders = res.headers;
            var statusCode = res.statusCode;
            var statusMessage = res.statusMessage;

            if ('content-type' in resHeaders && resHeaders['content-type'].indexOf("application/json") !== -1){

                var response = '';
                res.setEncoding('utf8');
                res.on('data', function(chunk) {
                    response += chunk;
                });
                res.on('end', function() {
                    try {
                        if(response == "\n" || response == ""){
                            response = {};
                        } else {
                            response = JSON.parse(response);
                        }

                        response.resHeaders = resHeaders;
                        response.statusCode = statusCode;
                        response.statusMessage = statusMessage;

                        if (response.error) {
                            var err;
                            var err_data = {};
                            if(typeof response.error === 'object'){
                                err_data = response.error;
                            } else if(typeof response.error === 'string'){
                                err_data['error_name'] = response.error;
                                err_data['error_msg'] = response.error_description;
                            }

                            err = Error.HelloSignError.generate(err_data);
                            return callback.call(self, err, null);
                        }
                    } catch (e) {
                        return callback.call(
                            self,
                            new Error.HelloSignAPIError({
                                message: 'Invalid JSON received from the HelloSign API',
                                response: response,
                                exception: e
                            }),
                            null
                        );
                    }
                    callback.call(self, null, response);
                });
            } else if ('content-transfer-encoding' in resHeaders && resHeaders['content-transfer-encoding'] == "binary"){
                callback.call(self, null, res);
            // Simplified response for code-only statuses
            } else if ('content-length' in resHeaders && resHeaders['content-length'] <= "1") {
                response = {};
                response.resHeaders = resHeaders;
                response.statusCode = statusCode;
                response.statusMessage = statusMessage;
                callback.call(self, null, response);
            } else {
                callback.call(self, null, res);
            }
        };
    },

    _errorHandler: function(req, callback) {
        var self = this;
        return function(error) {
            if (req._isAborted) return; // already handled
            if (!error || !error.message) {
                error = {
                    message: 'An error occurred with our connection to HelloSign',
                    detail: error
                };
            }
            callback.call(
                self,
                new Error.HelloSignConnectionError(error),
                null
            );
        }
    },
    _prepareOpts : function(data){

        if('signers' in data && Array.isArray(data.signers)){
            for(var i=0; i<data.signers.length;i++) {
                for(var signerIndex in data.signers[i]){
                    if(data.signers[i].hasOwnProperty(signerIndex)){
                        if('role' in data.signers[i]){
                            if(signerIndex == 'role'){
                                continue;
                            }
                            data["signers[" + data.signers[i]['role'] + "][" + signerIndex + "]"] = data.signers[i][signerIndex];
                        } else {
                            data["signers[" + i + "][" + signerIndex + "]"] = data.signers[i][signerIndex];
                        }
                    }
                }
            }
            delete data.signers;
        }
        if('cc_email_addresses' in data && Array.isArray(data.cc_email_addresses)){
            for(var i=0; i<data.cc_email_addresses.length;i++) {
                if(typeof data.cc_email_addresses[i]){
                    data["cc_email_addresses[" + i + "]"] = data.cc_email_addresses[i];
                }
            }
            delete data.cc_email_addresses;
        }

        //embedded endpoints adds
        if ('cc_roles' in data && Array.isArray(data.cc_email_addresses)) {
            for(var i=0; i < data.cc_roles.length; i++) {
                if(typeof data.cc_roles[i]){
                    data['cc_roles['+ i + ']'] = data.cc_roles[i];
                }
            }
            delete data.cc_roles;
        }

        if ('ccs' in data && Array.isArray(data.ccs)){
            for (var i=0; i < data.ccs.length; i++){
                data['ccs[' + data.ccs[i]['role_name'] + '][email_address]'] = data.ccs[i].email_address;
            }
            delete data.ccs;
        }

        if ('signer_roles' in data && Array.isArray(data.signer_roles)){
            for(var i=0; i < data.signer_roles.length; i++){
                if(data.signer_roles[i].hasOwnProperty('name')) {
                    data['signer_roles[' + i + '][name]'] = data.signer_roles[i]['name'];
                }
                if(data.signer_roles[i].hasOwnProperty('order')) {
                    data['signer_roles[' + i + '][order]'] = data.signer_roles[i]['order'];
                }
            }
            delete data.signer_roles;
        }

        if ('merge_fields' in data && Array.isArray(data.merge_fields)){
            data.merge_fields = JSON.stringify(data.merge_fields);
        }

        if ('custom_fields' in data && Array.isArray(data.custom_fields)){
            data.custom_fields = JSON.stringify(data.custom_fields);
        }

        if('template_ids' in data && Array.isArray(data.template_ids)){
            for(var i=0; i<data.template_ids.length;i++) {
                if(typeof data.template_ids[i]){
                    data["template_ids[" + i + "]"] = data.template_ids[i];
                }
            }
            delete data.template_ids;
        }

        if('templates' in data && Array.isArray(data.templates)){
            for(var i=0; i<data.templates.length;i++) {
                for(var templateIndex in data.templates[i]){
                    if(data.templates[i].hasOwnProperty(templateIndex)){
                        data["templates[" + i + "][" + templateIndex + "]"] = data.templates[i][templateIndex];
                    }
                }
            }
            delete data.templates;
        }

        if ('form_fields_per_document' in data && Array.isArray(data.form_fields_per_document)){
            data.form_fields_per_document = JSON.stringify(data.form_fields_per_document);
        }

        // Deprecated, but saving for compatibility
        if('clientId' in data) {
            data['client_id'] = data.clientId;
            delete data.clientId;
        }

        // Correct syntax; will overwrite the above.
        if('client_id' in data) {
            data['client_id'] = data.client_id;
        }

        for(var prop in data){
            if (data.hasOwnProperty(prop)){
                if (typeof data[prop] === "object" && prop != "files"){
                    for(var paramName in data[prop]){
                        if(data[prop].hasOwnProperty(paramName)){
                            data[prop + "[" + paramName + "]"] = data[prop][paramName];
                        }
                    }
                    delete data[prop];
                }
            }
        }

        if('files' in data && Array.isArray(data.files)){
            // submit as form
            var form = new FormData();
            for(var i=0; i<data.files.length;i++) {
                form.append("file[" + i + "]", fs.createReadStream(data.files[i]));
            }
            delete data.files;
            for(var paramName in data){
                if(data.hasOwnProperty(paramName)){
                    form.append(paramName, data[paramName]);
                }
            }
            return {requestData: "", formData: form}
        } else {
            var requestData = utils.stringifyRequestData(data || {});
            return {requestData: requestData, formData: null}
        }
    },
    _request: function(method, path, data, auth, callback) {
        var self = this;
        var apiVersion = this._hellosign.getApiField('version');
        var headers = this._setDefaultHeaders(auth);
        var preparedData = this._prepareOpts(data);

        var form = preparedData.formData;
        var requestData = preparedData.requestData;

        if(form){
            var formHeaders = form.getHeaders();
            for (var i in formHeaders) {
                // Prevent duplicate headers, using form values when sending files
                if (i === 'content-type') {
                  headers['Content-Type'] = formHeaders[i];
                  continue;
                }
                if (hasOwn.call(formHeaders, i)) {
                    headers[i] = formHeaders[i];
                }
            }
        }

        if (apiVersion) {
            headers['HelloSign-Version'] = apiVersion;
        }
        makeRequest();
        function makeRequest() {

            var timeout = self._hellosign.getApiField('timeout');
            var isInsecureConnection = self._hellosign.getApiField('protocol') == 'http';
            var host = self._hellosign.getApiField('host');
            var host = path.indexOf('oauth') === -1 ? host : host.replace('api', 'app');
            // Add params for dev environment
            path = self._hellosign.isDev() ? '/apiapp_dev.php' + path : path;
            if(method == "GET"){
                path = path + "?" + requestData;
            }
            var req = (
                isInsecureConnection ? http : https
                ).request({
                    host: host,
                    port: self._hellosign.getApiField('port'),
                    path: path,
                    method: method,
                    rejectUnauthorized: self._hellosign.isDev()? false : true,
                    requestCert: true,
                    headers: headers,
                    ciphers: "DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!MD5"
                });
            if(form != null){
                form.pipe(req);

                form.on('error', self._errorHandler(req, callback));
            }
            process.env.NODE_TLS_REJECT_UNAUTHORIZED = "1";
            req.setTimeout(timeout, self._timeoutHandler(timeout, req, callback));
            req.on('response', self._responseHandler(req, callback));
            req.on('error', self._errorHandler(req, callback));
            req.on('socket', function(socket) {
                socket.on((isInsecureConnection ? 'connect' : 'secureConnect'), function() {
                    // Send payload; we're safe:
                    if (requestData && requestData != "") {
                      req.write(requestData);
                    }
                    // If not using form, end here
                    if (form == null) {
                        req.end();
                    }
                });
            });
            req.on('finish', function(){
                // Waits for finish event when using form
                req.end();
            });

        }
    },

    _setDefaultHeaders: function(auth) {
        var headers = {};

        headers['Authorization'] = this._createAuthHeader(auth);
        headers['Accept'] = 'application/json';
        headers['Content-Type'] = 'application/x-www-form-urlencoded';
        headers['User-Agent'] = 'hellosign-nodejs-sdk/' + this._hellosign.getConstant('PACKAGE_VERSION');

        return headers;
    },

    _createAuthHeader: function(methodAuthKey) {

        var token = this._hellosign.getApiField('oauthToken');
        var authField = this._hellosign.getApiField('auth');

        // Method specific auth key overrides others
        if (methodAuthKey){
            return 'Basic ' + Buffer.from(methodAuthKey + ':').toString('base64');
        }

        if (token) {
            return token;
        }

        if (authField) {
            return authField;
        }

    }
};

module.exports = HelloSignResource;


text:
import factories from '../../setup/factories'
import { mockify, unspyify } from '../../setup/helpers'

describe('PushNotification', () => {
  var device, pushNotification, tmpEnvVar, notifyCall

  before(() => {
    tmpEnvVar = process.env.PUSH_NOTIFICATIONS_ENABLED
    device = factories.device()

    return device.save()
  })

  beforeEach(async () => {
    notifyCall = null
    mockify(OneSignal, 'notify', spy(opts => {
      notifyCall = opts
    }))

    pushNotification = new PushNotification({
      alert: 'hi',
      path: '/post',
      badge_no: 7,
      platform: 'ios_macos'
    })
    await pushNotification.set('device_id', device.id)
    await pushNotification.save()
  })

  after(() => {
    process.env.PUSH_NOTIFICATIONS_ENABLED = tmpEnvVar
    unspyify(OneSignal, 'notify')
  })

  describe('without PUSH_NOTIFICATIONS_ENABLED', () => {
    var user, post

    before(() => {
      delete process.env.PUSH_NOTIFICATIONS_ENABLED
    })

    beforeEach(async () => {
      var username = 'username'
      var postname = 'My Post'
      user = await factories.user({name: username}).save()
      post = await factories.post({user_id: user.id, name: postname}).save()
    })

    it('returns correct text with textForAnnouncement', async () => {
      await post.load('user')
      const person = post.relations.user.get('name')
      const postName = post.get('name')
      var expected = `${person} sent an announcement titled "${postName}"`
      expect(PushNotification.textForAnnouncement(post)).to.equal(expected)
    })

    it('sets sent_at and disabled', function () {
      return pushNotification.send()
        .then(result => {
          return pushNotification.fetch()
            .then(pn => {
              expect(pn.get('sent_at')).not.to.equal(null)
              expect(pn.get('disabled')).to.be.true
            })
        })
    })

    describe('with PUSH_NOTIFICATIONS_TESTING_ENABLED', () => {
      var tmpEnvVar2

      before(() => {
        tmpEnvVar2 = process.env.PUSH_NOTIFICATIONS_TESTING_ENABLED
        process.env.PUSH_NOTIFICATIONS_TESTING_ENABLED = true
      })

      after(() => {
        process.env.PUSH_NOTIFICATIONS_TESTING_ENABLED = tmpEnvVar2
      })

      it('sets sent_at and disabled for a non-test device', async () => {
        await pushNotification.send()
        const pn = await pushNotification.fetch()
        expect(pn.get('sent_at')).not.to.equal(null)
        expect(pn.get('disabled')).to.be.true
        expect(OneSignal.notify).not.to.have.been.called()
      })

      it('sends for a test device', async () => {
        await device.save({tester: true}, {patch: true})
        const result = await pushNotification.send()
        const pn = await pushNotification.fetch()
        expect(pn.get('sent_at')).not.to.equal(null)
        expect(pn.get('disabled')).to.be.false
        expect(OneSignal.notify).to.have.been.called()
      })
    })
  })

  describe('with PUSH_NOTIFICATIONS_ENABLED', () => {
    before(() => {
      process.env.PUSH_NOTIFICATIONS_ENABLED = true
    })

    it('sends for a non-test device with token', async () => {
      await device.save({token: 'foo'}, {patch: true})
      const result = await pushNotification.send()
      const pn = await pushNotification.fetch()

      expect(pn.get('sent_at')).not.to.equal(null)
      expect(pn.get('disabled')).to.be.false
      expect(OneSignal.notify).to.have.been.called()

      expect(notifyCall).to.deep.equal({
        platform: 'ios_macos',
        deviceToken: 'foo',
        playerId: null,
        alert: 'hi',
        path: '/post',
        badgeNo: 7
      })
    })

    it('sends for a non-test device with player id', async () => {
      await device.save({token: null, player_id: 'bar'}, {patch: true})
      const result = await pushNotification.send()
      const pn = await pushNotification.fetch()

      expect(pn.get('sent_at')).not.to.equal(null)
      expect(pn.get('disabled')).to.be.false
      expect(OneSignal.notify).to.have.been.called()

      expect(notifyCall).to.deep.equal({
        platform: 'ios_macos',
        deviceToken: null,
        playerId: 'bar',
        alert: 'hi',
        path: '/post',
        badgeNo: 7
      })
    })
  })
})


text:
package main

import (
	"github.com/mjibson/go-dsp/wav"
)

// Sample represents PCM data as a TFunc
type Sample struct {
	wav    *wav.Wav
	buffer []float32
}

// NewSample creates a new Sample struct
func NewSample(wav *wav.Wav) (*Sample, error) {
	sample := new(Sample)
	sample.wav = wav

	buffer, error := wav.ReadFloats(wav.Samples)
	if error != nil {
		return nil, error
	}
	sample.buffer = buffer

	return sample, nil
}

// AsTFunc returns a TFunc expressing the underlying sample data.
// Zero is returned for timecodes beyond the length of the sample.
func (sample *Sample) AsTFunc() TFunc {
	return func(t Timecode) Amplitude {
		if int(t) >= sample.wav.Samples {
			return 0
		}
		return Amplitude(sample.buffer[t])
	}
}

// AsLoopingTFunc returns a TFunc expressing the underlying sample data in a loop.
func (sample *Sample) AsLoopingTFunc() TFunc {
	return func(t Timecode) Amplitude {
		tsample := uint64(t) % uint64(sample.wav.Samples)
		return Amplitude(sample.buffer[tsample])
	}
}


text:
using namespace phosphor::logging;

namespace hwmon
{

uint64_t FanPwm::target(uint64_t value)
{
    using namespace std::literals;

    std::string empty;
    // Write target out to sysfs
    try
    {
        _ioAccess->write(value, _type, _id, empty, hwmonio::retries,
                         hwmonio::delay);
    }
    catch (const std::system_error& e)
    {
        using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
        report<WriteFailure>(
            xyz::openbmc_project::Control::Device::WriteFailure::CALLOUT_ERRNO(
                e.code().value()),
            xyz::openbmc_project::Control::Device::WriteFailure::
                CALLOUT_DEVICE_PATH(_devPath.c_str()));

        auto file =
            sysfs::make_sysfs_path(_ioAccess->path(), _type, _id, empty);

        log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}", file,
                                     e.code().value())
                             .c_str());

        exit(EXIT_FAILURE);
    }

    return FanPwmObject::target(value);
}

} // namespace hwmon


text:
#ifndef RMF_INTERNAL_MULTIPLE_AVRO_FILE_WRITER_H
#define RMF_INTERNAL_MULTIPLE_AVRO_FILE_WRITER_H

#include "avrocpp/api/DataFile.hh"
#include "AllJSON.h"
#include "FrameJSON.h"
#include <boost/shared_ptr.hpp>
#include <string>
#include <vector>

#include "MultipleAvroFileBase.h"
#include "RMF/ID.h"
#include "RMF/config.h"
#include "RMF/constants.h"
#include "RMF/enums.h"
#include "RMF/exceptions.h"
#include "RMF/infrastructure_macros.h"
#include "RMF/internal/SharedData.h"
#include "AvroKeysAndCategories.h"

namespace internal_avro {
template <typename T>
class DataFileWriter;
}  // namespace internal_avro

RMF_ENABLE_WARNINGS

namespace RMF {
namespace avro_backend {

class MultipleAvroFileWriter : public MultipleAvroFileBase {
  bool file_dirty_;
  bool nodes_dirty_;
  bool frames_dirty_;
  std::vector<bool> static_categories_dirty_;

  struct CategoryData {
    boost::shared_ptr<internal_avro::DataFileWriter<RMF_avro_backend::Data> >
        writer;
    RMF_avro_backend::Data data;
    bool dirty;
  };

  std::vector<CategoryData> categories_;

  RMF_avro_backend::Data null_frame_data_;
  RMF_avro_backend::Data null_static_frame_data_;
  boost::shared_ptr<internal_avro::DataFileWriter<RMF_avro_backend::Frame> >
      frame_writer_;
  RMF_avro_backend::Frame frame_;

 protected:
  const RMF_avro_backend::Data& get_frame_data(Category cat,
                                               FrameID frame) const {
    if (frame == ALL_FRAMES) {
      if (static_categories_.size() > cat.get_index()) {
        return static_categories_[cat.get_index()];
      } else {
        return null_static_data_;
      }
    } else {
      if (categories_.size() > cat.get_index()) {
        return categories_[cat.get_index()].data;
      } else {
        return null_data_;
      }
    }
  }

  RMF_avro_backend::Data& access_frame_data(Category cat, FrameID frame) {
    if (frame == ALL_FRAMES) {
      if (static_categories_.size() <= cat.get_index()) {
        RMF_avro_backend::Data data;
        data.frame = -1;
        static_categories_.resize(cat.get_index() + 1, data);
        static_categories_dirty_.resize(cat.get_index() + 1, false);
      }
      static_categories_dirty_[cat.get_index()] = true;
      return static_categories_[cat.get_index()];
    } else {
      while (categories_.size() <= cat.get_index()) {
        categories_.push_back(CategoryData());
        categories_.back().dirty = false;
        categories_.back().data.frame = frame.get_index();
      }
      categories_[cat.get_index()].dirty = true;
      return categories_[cat.get_index()].data;
    }
  }

  RMF_avro_backend::Node& access_node(NodeID node) {
    nodes_dirty_ = true;
    if (nodes_.size() <= static_cast<unsigned int>(node.get_index())) {
      nodes_.resize(node.get_index() + 1);
    }
    return nodes_[node.get_index()];
  }

  RMF_avro_backend::File& access_file() {
    file_dirty_ = true;
    return file_;
  }
  void commit();

 public:
  void flush() {}
  void reload() {
    RMF_THROW(Message("Can't reload writable file"), UsageException);
  }

  MultipleAvroFileWriter(std::string path, bool create, bool read_only);
  ~MultipleAvroFileWriter();

  void set_loaded_frame(FrameID frame);

  FrameID add_frame(std::string name, FrameType t);
  void add_child_frame(FrameID child_node);
  FrameIDs get_children(FrameID node) const;
  using AvroKeysAndCategories::get_name;
  std::string get_loaded_frame_name() const;
  FrameType get_loaded_frame_type() const;
  unsigned int get_number_of_frames() const;
};

}  // namespace avro_backend
} /* namespace RMF */

RMF_DISABLE_WARNINGS

#endif /* RMF_INTERNAL_MULTIPLE_AVRO_FILE_WRITER_H */


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.1.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
                        http://www.springframework.org/schema/tx
						http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
						http://www.springframework.org/schema/aop
						http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
						http://www.springframework.org/schema/task
						http://www.springframework.org/schema/task/spring-task-4.0.xsd
						">

	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close" lazy-init="false">
		<property name="url" value="${db.baseapi.url}" />
		<property name="username" value="${db.baseapi.username}" />
		<property name="password" value="${db.baseapi.password}" />
		<property name="driverClassName" value="${db.baseapi.driver}" />
		<property name="maxActive" value="${db.baseapi.maxActive}" />
		<property name="minIdle" value="${db.baseapi.minIdle}" />
		<property name="initialSize" value="${db.baseapi.initialSize}" />
		<property name="maxWait" value="${db.baseapi.maxWait}" />
		<property name="validationQuery" value="SELECT 'x' FROM DUAL" />
		<property name="filters" value="stat,log4j" />
		<property name="proxyFilters">
			<list>
				<ref bean="stat-filter" />
                <!-- <ref bean="logFilter" /> -->
			</list>
		</property>
	</bean>

	<bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
		<property name="slowSqlMillis" value="10000" />
		<property name="logSlowSql" value="true" />
	</bean>

	<bean id="logFilter" class="com.alibaba.druid.filter.logging.Log4jFilter">
        <!-- <property name="resultSetLogEnabled" value="false" /> -->
        <!-- <property name="statementExecutableSqlLogEnable" value="true" /> -->
    </bean>

	<!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="classpath:mybatis/mybatis-config.xml" />
		<!-- 自动扫描mapping.xml文件 -->
		<property name="mapperLocations" value="classpath:com/wicresoft/erp/dao/mapping/*.xml"></property>
	</bean>

	<!-- DAO接口所在包名,Spring会自动查找其下的类 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.wicresoft.erp.dao" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
	</bean>

	<!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<tx:advice id="trAdvice" transaction-manager="transactionManager">
		<tx:attributes>
	        <tx:method name="*"/>
			<tx:method name="get*" propagation="REQUIRED" read-only="true"/>
			<tx:method name="query*" propagation="REQUIRED" read-only="true"/>
			<tx:method name="search*" propagation="REQUIRED" read-only="true"/>
			<tx:method name="find*" propagation="REQUIRED" read-only="true"/>
			<tx:method name="save*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="delete*" propagation="REQUIRED" />
	      	<!-- 其他方法以默认事务进行 -->
      	</tx:attributes>
	</tx:advice>

	<aop:config>
		<aop:pointcut expression="execution(* com.wicresoft.erp.service.impl..*.*(..))" id="trPointcut" />
		<aop:advisor advice-ref="trAdvice" pointcut-ref="trPointcut" />
	</aop:config>

	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
		<constructor-arg ref="dataSource" />
	</bean>

</beans>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Diaporthe macrospora Wehm.

### Remarks
null


text:
<?php

namespace Topycs\Bundle\BootstrapBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class TopycsBootstrapBundle extends Bundle
{
}


text:
package quark;

public class ServiceInstance implements io.datawire.quark.runtime.QObject {
    public static quark.reflect.Class quark_ServiceInstance_ref = quark_md.Root.quark_ServiceInstance_md;
    public String serviceName;
    public String url;
    public quark.behaviors.CircuitBreaker breaker;
    public ServiceInstance(String serviceName, String url, Integer failureLimit, Double retestDelay) {
        (this).serviceName = serviceName;
        (this).url = url;
        (this).breaker = new quark.behaviors.CircuitBreaker((((("[") + (serviceName)) + (" at ")) + (url)) + ("]"), failureLimit, retestDelay);
    }
    public Boolean isActive() {
        return ((this).breaker).active;
    }
    public String getURL() {
        return (this).url;
    }
    public void succeed(String info) {
        if (!((this).isActive())) {
            (Client.logger).info(((("- CLOSE breaker for ") + ((this).serviceName)) + (" at ")) + ((this).url));
        }
        ((this).breaker).succeed();
    }
    public void fail(String info) {
        if (!((this).isActive())) {
            (Client.logger).warn(((("- OPEN breaker for ") + ((this).serviceName)) + (" at ")) + ((this).url));
        }
        ((this).breaker).fail();
    }
    public String _getClass() {
        return "quark.ServiceInstance";
    }
    public Object _getField(String name) {
        if ((name)==("serviceName") || ((Object)(name) != null && ((Object) (name)).equals("serviceName"))) {
            return (this).serviceName;
        }
        if ((name)==("url") || ((Object)(name) != null && ((Object) (name)).equals("url"))) {
            return (this).url;
        }
        if ((name)==("breaker") || ((Object)(name) != null && ((Object) (name)).equals("breaker"))) {
            return (this).breaker;
        }
        return null;
    }
    public void _setField(String name, Object value) {
        if ((name)==("serviceName") || ((Object)(name) != null && ((Object) (name)).equals("serviceName"))) {
            (this).serviceName = (String) (value);
        }
        if ((name)==("url") || ((Object)(name) != null && ((Object) (name)).equals("url"))) {
            (this).url = (String) (value);
        }
        if ((name)==("breaker") || ((Object)(name) != null && ((Object) (name)).equals("breaker"))) {
            (this).breaker = (quark.behaviors.CircuitBreaker) (value);
        }
    }
}