text:
/* -*- mode: c++; fill-column: 132; c-basic-offset: 4; indent-tabs-mode: nil -*- */

/*** Copyright (c), The Regents of the University of California            ***
 *** For more information please refer to files in the COPYRIGHT directory ***/
/* rsFileWrite.c - server routine that handles the fileWrite
 * API
 */

/* script generated code */
#include "fileWrite.hpp"
#include "miscServerFunct.hpp"
#include "rsGlobalExtern.hpp"
#include <sstream>

// =-=-=-=-=-=-=-
#include "irods_log.hpp"
#include "irods_file_object.hpp"
#include "irods_stacktrace.hpp"

int
rsFileWrite( rsComm_t *rsComm, fileWriteInp_t *fileWriteInp,
             bytesBuf_t *fileWriteInpBBuf ) {
    rodsServerHost_t *rodsServerHost;
    int remoteFlag;
    int retVal;

    remoteFlag = getServerHostByFileInx( fileWriteInp->fileInx,
                                         &rodsServerHost );

    if ( remoteFlag == LOCAL_HOST ) {
        retVal = _rsFileWrite( rsComm, fileWriteInp, fileWriteInpBBuf );
    }
    else if ( remoteFlag == REMOTE_HOST ) {
        retVal = remoteFileWrite( rsComm, fileWriteInp, fileWriteInpBBuf,
                                  rodsServerHost );
    }
    else {
        if ( remoteFlag < 0 ) {
            return ( remoteFlag );
        }
        else {
            rodsLog( LOG_NOTICE,
                     "rsFileWrite: resolveHost returned unrecognized value %d",
                     remoteFlag );
            return ( SYS_UNRECOGNIZED_REMOTE_FLAG );
        }
    }

    if ( retVal >= 0 ) {
        FileDesc[fileWriteInp->fileInx].writtenFlag = 1;
    }

    return ( retVal );
}

int
remoteFileWrite( rsComm_t *rsComm, fileWriteInp_t *fileWriteInp,
                 bytesBuf_t *fileWriteInpBBuf, rodsServerHost_t *rodsServerHost ) {
    int retVal;

    if ( rodsServerHost == NULL ) {
        rodsLog( LOG_NOTICE,
                 "remoteFileWrite: Invalid rodsServerHost" );
        return SYS_INVALID_SERVER_HOST;
    }

    if ( ( retVal = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
        return retVal;
    }

    fileWriteInp->fileInx = convL3descInx( fileWriteInp->fileInx );
    retVal = rcFileWrite( rodsServerHost->conn, fileWriteInp,
                          fileWriteInpBBuf );

    if ( retVal < 0 ) {
        rodsLog( LOG_NOTICE,
                 "remoteFileWrite: rcFileWrite failed for %s",
                 FileDesc[fileWriteInp->fileInx].fileName );
    }

    return retVal;
}

// =-=-=-=-=-=-=-
// _rsFileWrite - this the local version of rsFileWrite.
int _rsFileWrite(
    rsComm_t*       _comm,
    fileWriteInp_t* _write_inp,
    bytesBuf_t*     _write_bbuf ) {
    // =-=-=-=-=-=-=-
    // XXXX need to check resource permission and vault permission
    // when RCAT is available

    // =-=-=-=-=-=-=-
    // make a call to the resource write
    irods::file_object_ptr file_obj(
        new irods::file_object(
            _comm,
            FileDesc[_write_inp->fileInx].objPath,
            FileDesc[_write_inp->fileInx].fileName,
            FileDesc[_write_inp->fileInx].rescHier,
            FileDesc[_write_inp->fileInx].fd,
            0, 0 ) );

    irods::error write_err = fileWrite( _comm,
                                        file_obj,
                                        _write_bbuf->buf,
                                        _write_inp->len );
    // =-=-=-=-=-=-=-
    // log error if necessary
    if ( !write_err.ok() ) {
        std::stringstream msg;
        msg << "fileWrite for [";
        msg << file_obj->physical_path();
        msg << "]";
        irods::error err = PASSMSG( msg.str(), write_err );
        irods::log( err );
    }

    return write_err.code();

} // _rsFileWrite


text:
BN.addDecl('accordian-list-item-nestedlist').dataTemplate(function(ctx){
    return BN('pressa-api').get(ctx.param('category')).then(function(data){
        ctx.param('lastTitles', data);
    });
});

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import { Router, Route, Link } from 'react-router';

// Flux
import BlogActions from '../../actions/BlogActions';
import BlogStore from '../../stores/BlogStore';

const PostForm = React.createClass({

  getInitialState(){
    var state = {
      title:'',
      content:'',
      event:'',
      weight:'',
      reps:''
    };
    return state;
  },

  componentDidMount(){
    BlogStore.addChangeListener(this.articleUpdate);
  },

  componentWillUnmount(){
    BlogStore.removeChangeListener(this.articleUpdate);
  },

  articleUpdate(){
    this.setState({
      title:'',
      content:'',
      event:'',
      weight:'',
      reps:''
    });
  },

  _onTitleChange(e){
    this.setState({
      title:e.target.value
    });
  },

  _onContentChange(e){
    this.setState({
      content:e.target.value
    });
  },

  _onEventChange(e){
    this.setState({
      event:e.target.value
    });
  },

  _onWeightChange(e){
    this.setState({
      weight:e.target.value
    });
  },

  _onRepsChange(e){
    this.setState({
      reps:e.target.value
    });
  },

  _onSubmit(){
    var obj = {
      title: this.state.title,
      content: this.state.content,
      event: this.state.event,
      weight: this.state.weight,
      reps: this.state.reps
    }
    BlogActions.create(obj);

      this.setState({
        title:'',
        content:'',
        event:'',
        weight:'',
        reps:''
      });
  },

  render(){
    return(
      <div>
        <input type='text' placeholder='Title' onChange={this._onTitleChange} value={this.state.title} />
        <input type='text' placeholder='Content' onChange={this._onContentChange} value={this.state.content} />

        <select onChange={this._onEventChange} value={this.state.event}>
           <option value=" "></option>
          <option value="仰臥起坐">仰臥起坐</option>
          <option value="伏地挺身">伏地挺身</option>
           <option value="啞鈴">啞鈴</option>
        </select>

        <input type='text' placeholder='Weight' onChange={this._onWeightChange} value={this.state.weight} />
        <input type='text' placeholder='Reps' onChange={this._onRepsChange} value={this.state.reps} />
        <button type='button' onClick={this._onSubmit}> Submit </button>
      </div>
    )
  }
});

module.exports = PostForm;


text:
[Elm](https://elm-lang.org/) is a programming language that compiles to JavaScript. It is known for its friendly error messages, helping you find issues quickly and refactor large projects with confidence. Elm is also [very fast](https://elm-lang.org/blog/blazing-fast-html-round-two) and [very small](https://elm-lang.org/blog/small-assets-without-the-headache) when compared with React, Angular, Ember, etc.

This repo focuses on **The Elm Architecture**, an architecture pattern you see in all Elm programs. It has influenced projects like Redux that borrow core concepts but add many JS-focused ideas.

## The Elm Architecture

The Elm Architecture is a simple pattern for architecting webapps. The core idea is that your code is built around a `Model` of your application state, a way to `update` your model, and a way to `view` your model.

To learn more about this, read the [the official guide][guide] and check out [this section][arch] which is all about The Elm Architecture. This repo is a collection of all the examples in that section, so you can follow along and compile things on your computer as you read through.

[guide]: https://guide.elm-lang.org/
[arch]: https://guide.elm-lang.org/architecture/

## Run The Examples

After you [install](https://guide.elm-lang.org/install.html), run the following commands in your terminal to download this repo and start a server that compiles Elm for you:

```bash
git clone https://github.com/evancz/elm-architecture-tutorial.git
cd elm-architecture-tutorial
elm reactor
```

Now go to [http://localhost:8000/](http://localhost:8000/) and start looking at the `examples/` directory. When you edit an Elm file, just refresh the corresponding page in your browser and it will recompile!


text:
package cn.wwah.common.image;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;

/**
 * Created by Jixiang_Li on 2017/2/6.
 */

interface ILargeImageView {

    int getImageWidth();

    int getImageHeight();

    boolean hasLoad();

    void setOnImageLoadListener(BlockImageLoader.OnImageLoadListener onImageLoadListener);

    void setImage(BitmapDecoderFactory factory);

    void setImage(BitmapDecoderFactory factory, Drawable defaultDrawable);

    void setImage(Bitmap bm);

    void setImage(Drawable drawable);

    void setImage(@DrawableRes int resId);

    void setImageDrawable(Drawable drawable);

    void setScale(float scale);

    float getScale();

    BlockImageLoader.OnImageLoadListener getOnImageLoadListener();
}


text:
using System;
using System.Diagnostics.CodeAnalysis;

namespace ToolKit.DirectoryServices.ServiceInterfaces
{
    /// <summary>
    /// Specifies the security level used in authenticating a client.
    /// </summary>
    [SuppressMessage(
        "Microsoft.Naming",
        "CA1707:IdentifiersShouldNotContainUnderscores",
        Justification = "This enumeration represents Win32API which include underscores.")]
    [Flags]
    [SuppressMessage(
        "Design",
        "RCS1135:Declare enum member with zero value (when enum has FlagsAttribute).",
        Justification = "Win32Apis dont follow the rules.")]
    [SuppressMessage(
        "Readability",
        "RCS1234:Duplicate enum value.",
        Justification = "Win32Apis dont follow the rules.")]
    public enum ADS_AUTHENTICATION : uint
    {
        /// <summary>
        /// Requests secure authentication. When this flag is set, the WinNT provider uses NT LAN
        /// Manager (NTLM) to authenticate the client. Active Directory will use Kerberos, and
        /// possibly NTLM, to authenticate the client. When the user name and password are NULL,
        /// ADSI binds to the object using the security context of the calling thread, which is
        /// either the security context of the user account under which the application is running
        /// or of the client user account that the calling thread represents.
        /// </summary>
        SECURE_AUTHENTICATION = 0x1,

        /// <summary>
        /// Requires ADSI to use encryption for data exchange over the network.
        /// Note: This option is not supported by the WinNT provider.
        /// </summary>
        USE_ENCRYPTION = 0x2,

        /// <summary>
        /// The channel is encrypted using Secure Sockets Layer (SSL). Active Directory requires
        /// that the Certificate Server be installed to support SSL. If this flag is not combined
        /// with the ADS_SECURE_AUTHENTICATION flag and the supplied credentials are NULL, the bind
        /// will be performed anonymously. If this flag is combined with the
        /// ADS_SECURE_AUTHENTICATION flag and the supplied credentials are NULL, then the
        /// credentials of the calling thread are used.
        /// Note: This option is not supported by the WinNT provider.
        /// </summary>
        USE_SSL = 0x2,

        /// <summary>
        /// A write-able domain controller is not required. For a Windows NT 4.0 network, ADSI will
        /// attempt to connect to either a primary domain controller (PDC) or a backup domain
        /// controller (BDC) because BDCs are read-only. On a Windows Server 2003 or Windows 2000
        /// network, all servers are writable, so this flag has no affect.
        /// </summary>
        READONLY_SERVER = 0x4,

        /// <summary>
        /// This flag is deprecated.
        /// </summary>
        PROMPT_CREDENTIALS = 0x8,

        /// <summary>
        /// Request no authentication. The providers may attempt to bind the client, as an anonymous
        /// user, to the target object. The WinNT provider does not support this flag. Active
        /// Directory establishes a connection between the client and the targeted object, but will
        /// not perform authentication. Setting this flag amounts to requesting an anonymous
        /// binding, which indicates all users as the security context.
        /// </summary>
        NO_AUTHENTICATION = 0x10,

        /// <summary>
        /// When this flag is set, ADSI will not attempt to query the objectClass property and thus
        /// will only expose the base interfaces supported by all ADSI objects instead of the full
        /// object support. A user can use this option to increase the performance in a series of
        /// object manipulations that involve only methods of the base interfaces. However, ADSI
        /// will not verify that any of the requested objects actually exist on the server. For more
        /// information, see Fast Binding Options for Batch Write/Modify Operations. This option is
        /// also useful for binding to non-Active Directory directory services, for example Exchange
        /// 5.5, where the objectClass query would fail.
        /// </summary>
        FAST_BIND = 0x20,

        /// <summary>
        /// Verifies data integrity. The ADS_SECURE_AUTHENTICATION flag must also be set also to use signing.
        /// Note: This option is not supported by the WinNT provider.
        /// </summary>
        USE_SIGNING = 0x40,

        /// <summary>
        /// Encrypts data using Kerberos. The ADS_SECURE_AUTHENTICATION flag must also be set to use sealing.
        /// Note: This option is not supported by the WinNT provider.
        /// </summary>
        USE_SEALING = 0x80,

        /// <summary>
        /// Enables ADSI to delegate the user security context, which is necessary for moving
        /// objects across domains.
        /// </summary>
        USE_DELEGATION = 0x100,

        /// <summary>
        /// Windows 2000 SP1 and later: Specify this flag when using the LDAP provider if your
        /// ADsPath includes a server name. Do not use this flag for paths that include a domain
        /// name or for a server-less bind. If you specify a server name without also specifying
        /// this flag, unnecessary network traffic can result.
        /// </summary>
        SERVER_BIND = 0x200,

        /// <summary>
        /// Specify this flag to turn referral chasing off for the life of the connection. However,
        /// even when this flag is specified, ADSI still allows the setting of referral chasing
        /// behavior for container enumeration when set using ADS_OPTION_REFERRALS in
        /// ADS_OPTION_ENUM (as documented in container enumeration with referral chasing in
        /// IADsObjectOptions::SetOption) and searching separately (as documented in Referral
        /// Chasing with IDirectorySearch).
        /// Note: This option is not supported by the WinNT provider.
        /// </summary>
        NO_REFERRAL_CHASING = 0x400,

        /// <summary>
        /// The enumeration value is Reserved.
        /// </summary>
        [SuppressMessage(
            "Major Code Smell",
            "S4016:Enumeration members should not be named \"Reserved\"",
            Justification = "Win32API don't always follow C# naming conventions.")]
        AUTH_RESERVED = 0x80000000
    }
}


text:
require 'active_record'
require 'active_support'
require 'ruby_extension'
require 'simply_helpful'
require 'gravatar'
#require 'calnet_authenticated'
require 'simply_authorized'
require 'acts_as_list'
module SimplyDocuments
#	predefine namespace
end
require 'simply_documents/owner'

#	This doesn't seem necessary
%w{models controllers}.each do |dir|
	path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
	ActiveSupport::Dependencies.autoload_paths << path
	ActiveSupport::Dependencies.autoload_once_paths << path
end

require 'action_controller'	#	loads HTML
HTML::WhiteListSanitizer.allowed_attributes.merge(%w(
	id class style
))

if defined?(Rails) && Rails.env == 'test' && Rails.class_variable_defined?("@@configuration")
	require 'active_support/test_case'
	require 'factory_girl'
	require 'simply_documents/factories'
#	else
#		running a rake task
end

#if RUBY_PLATFORM =~ /java/i
#	require 'simply_documents/file_utils_extension'
#end

require 'paperclip'
if defined? ::Paperclip::Glue
	ActiveRecord::Base.send(:include, ::Paperclip::Glue)
else
	ActiveRecord::Base.send(:include, ::Paperclip)
end

ActionController::Routing::Routes.add_configuration_file(
	File.expand_path(
		File.join(
			File.dirname(__FILE__), '../config/routes.rb')))

ActionController::Base.view_paths <<
	File.expand_path(
		File.join(
			File.dirname(__FILE__), '../app/views'))


text:
<?php
set_include_path( get_include_path().PATH_SEPARATOR."..");
include_once("xlsxwriter.class.php");

$header = array(
  'c1-text'=>'string',//text
  'c2-text'=>'@',//text
);
$rows = array(
  array('abcdefg','hijklmnop'),
);
$writer = new XLSXWriter();
$writer->setRightToLeft(true);

$writer->writeSheetHeader('Sheet1', $header);
foreach($rows as $row)
	$writer->writeSheetRow('Sheet1', $row);
$writer->writeToFile('xlsx-right-to-left.xlsx');


text:
<!-- ---
layout: page
title: About BDCO
permalink: /about/
tags: about
---

 -->


text:
import { styled } from '~/stitches.config';

export const Container = styled('header', {
  display: 'flex',
  flexDirection: 'column-reverse',
  alignItems: 'center',
  width: '100%',
  margin: '0 auto',
  padding: '2rem 0',

  '@md': {
    flexDirection: 'row',
    justifyContent: 'space-between',
  }
});

export const TitleWrapper = styled('div', {
  display: 'flex',
  flexDirection: 'row',
  alignItems: 'center',
  alignSelf: 'start',
  width: '100%',

  '@md': {
    width: 'auto',
  }
});

export const Circle = styled('div', {
  width: '4rem',
  height: '4rem',
  borderRadius: '50%',

  backgroundColor: '$headerCircleColor',

  transition: 'background-color $transitionDuration $transitionTiming',
});

export const Title = styled('h1', {
  marginLeft: '-2.5rem',

  color: '$text400',
  fontWeight: 900,
  fontSize: '2rem',
  lineHeight: '2rem',

  transition: 'color $transitionDuration $transitionTiming',

  a: {
    textDecoration: 'none',
  }
});


text:
window.addEventListener('load',function() {
  $(document).ready(function() {
    $('#livefilterdemo').liveFilter({
      delay: 200, // how long between keystroke and filter
      analyticsLogging: false, // log to google analytics through foundationExtendEBI.js
      fitlerTargetCustomDiv: 'div.live-filter-target-granularity',
      defaultText: 'Type to filter these paper references',
      noMatches: '
No matching papers found.
You could add a link to advanced search '
      // for further plugin option guidance, see: https://ebi.emblstatic.net/web_guidelines/EBI-Framework/v1.3/libraries/LiveFilter/js/jquery.liveFilter.js
    });
  });
});


text:
template <class T>
struct test
    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
{
    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
    typedef typename base::container_type container_type;
    typedef typename base::value_compare value_compare;

    explicit test(const test_allocator<int>& a) : base(a) {}
    test(const value_compare& comp, const test_allocator<int>& a)
        : base(comp, a) {}
    test(const value_compare& comp, const container_type& c,
        const test_allocator<int>& a) : base(comp, c, a) {}
#if TEST_STD_VER >= 11
    test(const value_compare& comp, container_type&& c,
         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
    test_allocator<int> get_allocator() {return c.get_allocator();}

    using base::c;
};

int main(int, char**)
{
    test<int> q(std::less<int>(), test_allocator<int>(3));
    assert(q.c.get_allocator() == test_allocator<int>(3));
    assert(q.c.size() == 0);

  return 0;
}


text:
package com.ycsoft.sysmanager.web.action.config;

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

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ycsoft.beans.config.TRuleEdit;
import com.ycsoft.beans.system.SSysChange;
import com.ycsoft.commons.abstracts.BaseAction;
import com.ycsoft.commons.constants.DictKey;
import com.ycsoft.commons.constants.SysChangeType;
import com.ycsoft.commons.exception.ActionException;
import com.ycsoft.commons.helper.StringHelper;
import com.ycsoft.commons.store.MemoryDict;
import com.ycsoft.commons.tree.TreeBuilder;
import com.ycsoft.commons.tree.TreeNode;
import com.ycsoft.daos.helper.BeanHelper;
import com.ycsoft.sysmanager.component.config.RuleComponent;
import com.ycsoft.sysmanager.component.system.ParamComponent;
import com.ycsoft.sysmanager.dto.config.RuleDefineDto;
import com.ycsoft.sysmanager.dto.config.RuleEditDto;

public class RuleAction extends BaseAction {

	/**
	 *
	 */
	private static final long serialVersionUID = -4755713479110498142L;

	private RuleComponent ruleComponent;
	private ParamComponent paramComponent;
	private RuleDefineDto rule;
	private String ruleId;
	private String comboQueryText;
	private String model_name;
	private String tableName;
	private String resultColumn;
	private String selectColumn;
	private String dataType;
	private String query;

	/**
	 * 根据数据类型查询对应规则属性
	 * @return
	 * @throws Exception
	 */
	public String queryRulePropByDataRightType() throws Exception {
		getRoot().setRecords(ruleComponent.queryRulePropByDataRightType(dataType));
		return JSON_RECORDS;
	}

	/**
	 * 根据用户选择的数据类型,动态查询数据
	 * @return
	 * @throws Exception
	 */
	public String queryDynamicData() throws Exception {
		getRoot().setRecords(ruleComponent.queryDynamicData(tableName, resultColumn, selectColumn));
		return JSON_RECORDS;
	}

	/**
	 * 查询所有数据类型
	 * @return
	 * @throws Exception
	 */
	public String queryAllSDataType() throws Exception {
		getRoot().setRecords(ruleComponent.queryAllSDataType());
		return JSON_RECORDS;
	}

	/**
	 * 地址树查询
	 * @return
	 * @throws Exception
	 */
	public String findAllAddress() throws Exception {
		List list = paramComponent.findAllAddress(comboQueryText,optr.getCounty_id());
		List<TreeNode> addTree = TreeBuilder.createTree(list);
		getRoot().setRecords(addTree);
		return JSON_RECORDS;
	}

	/**
	 * 明细规则配置
	 * @return
	 * @throws Exception
	 */
	public String updateDetailRule() throws Exception {
		RuleEditDto former = ruleComponent.queryRuleForCollectChangeInfo(rule);
		String ruleid = ruleComponent.updateDetailRule(rule);
		rule.setRule_id(ruleid);
		RuleEditDto newOne = ruleComponent.queryRuleForCollectChangeInfo(rule);
		saveSysChange(former,newOne);
		return JSON;
	}

	/**
	 * 手工规则配置
	 * @return
	 * @throws Exception
	 */
	public String updateHandRule() throws Exception {

		RuleEditDto former = ruleComponent.queryRuleForCollectChangeInfo(rule);
		rule.setRule_id(ruleComponent.updateHandRule(rule));
		RuleEditDto newOne = ruleComponent.queryRuleForCollectChangeInfo(rule);
		saveSysChange(former,newOne);
		return JSON;
	}

	/**
	 * 保存或修改条件规则
	 * @return
	 * @throws Exception
	 */
	public String updateRuleAndRuleEdit() throws Exception {
		String ruleInfo = request.getParameter("ruleEditDto");
		Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
		RuleEditDto ruleEditDto = gson.fromJson(ruleInfo, RuleEditDto.class);
		//规则对象
		RuleDefineDto rule = ruleEditDto.getRule();
		//规则编辑对象
		List<TRuleEdit> ruleEdits = ruleEditDto.getRuleEdits();

		RuleEditDto former = ruleComponent.queryRuleForCollectChangeInfo(rule);
		rule.setRule_id(ruleComponent.updateRuleAndRuleEdit(rule, ruleEdits));
		RuleEditDto theNewOne = ruleComponent.queryRuleForCollectChangeInfo(rule);

		saveSysChange(former,theNewOne);

		return JSON_SUCCESS;
	}

	private void saveSysChange(RuleEditDto former, RuleEditDto theNewOne) throws Exception{
		if(former ==null && theNewOne == null){
			throw new ActionException("比较的两个对象都为空!");
		}
		if(former ==null && theNewOne !=null){
			former = new RuleEditDto();
		}else if(theNewOne ==null && former !=null){
			theNewOne = new RuleEditDto();
		}
		RuleDefineDto oldRuleObj = former.getRule();
		if(null !=oldRuleObj){
			oldRuleObj.setOptr_id(MemoryDict.getDictName(DictKey.OPTR, oldRuleObj.getOptr_id()));
		}
		RuleDefineDto newRuleObj = theNewOne.getRule();
		if(null !=newRuleObj){
			String optrId = newRuleObj.getOptr_id();
			newRuleObj.setOptr_id(MemoryDict.getDictName(DictKey.OPTR, optrId));
		}

		List<SSysChange> changes = new ArrayList<SSysChange>();
		String [] basicChangeFields = new String [] {"rule_id","rule_name","remark","rule_type","data_type","cfg_type","pre_billing_rule","optr_id","eff_date","exp_date"};
		String basicChange = BeanHelper.beanchange(oldRuleObj, newRuleObj,basicChangeFields);
		//两个肯定最多只有一个为空,因此下面的方法可行
		String key = theNewOne ==null ? oldRuleObj.getRule_id() : theNewOne.getRule().getRule_id();
		String keyDesc = theNewOne ==null ? oldRuleObj.getRule_name() : theNewOne.getRule().getRule_name();

		String optrId = getOptr().getOptr_id();

		if(!StringHelper.isEmpty(basicChange)){
			//两个肯定最多只有一个为空,因此下面的方法可行
			SSysChange change = new SSysChange(SysChangeType.RULE.toString(),
					ruleComponent.getDoneCOde(), key, keyDesc, "规则基本定义", basicChange, optrId, new Date());
			changes.add(change);
		}

		String detailChange = BeanHelper.beanchange(oldRuleObj, newRuleObj,"rule_str");
		if(!StringHelper.isEmpty(detailChange)){
			//两个肯定最多只有一个为空,因此下面的方法可行
			SSysChange change = new SSysChange(SysChangeType.RULE.toString(),
					ruleComponent.getDoneCOde(), key, keyDesc, "规则详细内容", detailChange, optrId, new Date());
			changes.add(change);
		}

		String countyChange = BeanHelper.beanchange(oldRuleObj, newRuleObj,"county_name");
		if(!StringHelper.isEmpty(countyChange)){
			//两个肯定最多只有一个为空,因此下面的方法可行
			SSysChange change = new SSysChange(SysChangeType.RULE.toString(),
					ruleComponent.getDoneCOde(), key, keyDesc, "规则适用分公司", countyChange, optrId, new Date());
			changes.add(change);
		}

		if(!changes.isEmpty()){
			ruleComponent.getSSysChangeDao().save(changes.toArray(new SSysChange[changes.size()]));
		}

	}

	public String queryRuleEditByRuleId() throws Exception{
		getRoot().setRecords(ruleComponent.queryRuleEditByRuleId(ruleId));
		return JSON_RECORDS;
	}

	/**
	 * 规则属性
	 * @return
	 * @throws Exception
	 */
	public String queryRuleProp() throws Exception {
		getRoot().setRecords(ruleComponent.queryRuleProp(comboQueryText));
//		getRoot().setRecords(tRuleComponent.queryRuleProp(model_name));
		return JSON_RECORDS;
	}

	/**
	 * 规则对应的 引用对象
	 * @param rule_id 规则id
	 * @return
	 * @throws Exception
	 */
	public String queryRuleObjByRuleId() throws Exception{
		getRoot().setRecords(ruleComponent.queryRuleObjByRuleId(ruleId));
		return JSON_RECORDS;
	}

	public String getTruleByRuleId() throws Exception{
		getRoot().setSimpleObj(ruleComponent.getTruleByRuleId(ruleId));
		return JSON_SIMPLEOBJ;
	}

	public String queryAllRules() throws Exception {
		getRoot().setPage(ruleComponent.queryAllRules(query,dataType,optr.getCounty_id(),start,limit));
		return JSON_PAGE;
	}

	public String queryRuleCounty() throws Exception {
		getRoot().setRecords(ruleComponent.queryRuleCounty(optr));
		return JSON_RECORDS;
	}

	public void setTRuleComponent(RuleComponent ruleComponent) {
		ruleComponent = ruleComponent;
	}

	public void setRuleId(String ruleId) {
		this.ruleId = ruleId;
	}

	public void setComboQueryText(String comboQueryText) {
		this.comboQueryText = comboQueryText;
	}

	public void setModel_name(String model_name) {
		this.model_name = model_name;
	}

	public void setParamComponent(ParamComponent paramComponent) {
		this.paramComponent = paramComponent;
	}

	public RuleDefineDto getRule() {
		return rule;
	}

	public void setRule(RuleDefineDto rule) {
		this.rule = rule;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public void setResultColumn(String resultColumn) {
		this.resultColumn = resultColumn;
	}

	public void setSelectColumn(String selectColumn) {
		this.selectColumn = selectColumn;
	}

	public void setRuleComponent(RuleComponent ruleComponent) {
		this.ruleComponent = ruleComponent;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public void setQuery(String query) {
		this.query = query;
	}

}


text:
import argparse
import logging
from typing import Text, Union, Optional

from rasa.shared.constants import (
    DEFAULT_CONFIG_PATH,
    DEFAULT_DOMAIN_PATH,
    DEFAULT_MODELS_PATH,
    DEFAULT_DATA_PATH,
    DEFAULT_ENDPOINTS_PATH,
)

def add_model_param(
    parser: argparse.ArgumentParser,
    model_name: Text = "Rasa",
    add_positional_arg: bool = True,
    default: Optional[Text] = DEFAULT_MODELS_PATH,
) -> None:
    help_text = (
        "Path to a trained {} model. If a directory is specified, it will "
        "use the latest model in this directory.".format(model_name)
    )
    parser.add_argument("-m", "--model", type=str, default=default, help=help_text)
    if add_positional_arg:
        parser.add_argument(
            "model-as-positional-argument", nargs="?", type=str, help=help_text
        )

def add_stories_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    stories_name: Text = "training",
) -> None:
    parser.add_argument(
        "-s",
        "--stories",
        type=str,
        default=DEFAULT_DATA_PATH,
        help=f"File or folder containing your {stories_name} stories.",
    )

def add_nlu_data_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    help_text: Text,
    default: Optional[Text] = DEFAULT_DATA_PATH,
) -> None:
    parser.add_argument("-u", "--nlu", type=str, default=default, help=help_text)

def add_domain_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    default: Optional[Text] = DEFAULT_DOMAIN_PATH,
) -> None:
    parser.add_argument(
        "-d",
        "--domain",
        type=str,
        default=default,
        help="Domain specification. This can be a single YAML file, or a directory "
        "that contains several files with domain specifications in it. The content "
        "of these files will be read and merged together.",
    )

def add_config_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    default: Optional[Text] = DEFAULT_CONFIG_PATH,
) -> None:
    parser.add_argument(
        "-c",
        "--config",
        type=str,
        default=default,
        help="The policy and NLU pipeline configuration of your bot.",
    )

def add_out_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    help_text: Text,
    default: Optional[Text] = DEFAULT_MODELS_PATH,
    required: bool = False,
) -> None:
    parser.add_argument(
        "--out",
        type=str,
        default=default,
        help=help_text,
        # The desired behaviour is that required indicates if this argument must
        # have a value, but argparse interprets it as "must have a value
        # from user input", so we toggle it only if our default is not set
        required=required and default is None,
    )

def add_endpoint_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    help_text: Text,
    default: Optional[Text] = DEFAULT_ENDPOINTS_PATH,
) -> None:
    """Adds an option to an argument parser to configure endpoints path."""
    parser.add_argument("--endpoints", type=str, default=default, help=help_text)

def add_data_param(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    default: Optional[Text] = DEFAULT_DATA_PATH,
    required: bool = False,
    data_type: Text = "Rasa ",
) -> None:
    parser.add_argument(
        "--data",
        default=default,
        nargs="+",
        type=str,
        help=f"Paths to the files or directories containing {data_type} data.",
        # The desired behaviour is that required indicates if this argument must
        # have a value, but argparse interprets it as "must have a value
        # from user input", so we toggle it only if our default is not set
        required=required and default is None,
    )

def add_logging_options(parser: argparse.ArgumentParser) -> None:
    """Add options to an argument parser to configure logging levels."""

    logging_arguments = parser.add_argument_group("Python Logging Options")

    # arguments for logging configuration
    logging_arguments.add_argument(
        "-v",
        "--verbose",
        help="Be verbose. Sets logging level to INFO.",
        action="store_const",
        dest="loglevel",
        const=logging.INFO,
    )
    logging_arguments.add_argument(
        "-vv",
        "--debug",
        help="Print lots of debugging statements. Sets logging level to DEBUG.",
        action="store_const",
        dest="loglevel",
        const=logging.DEBUG,
    )
    logging_arguments.add_argument(
        "--quiet",
        help="Be quiet! Sets logging level to WARNING.",
        action="store_const",
        dest="loglevel",
        const=logging.WARNING,
    )


text:
package org.apache.catalina.mbeans;

import java.io.File;

import javax.management.MBeanServer;
import javax.management.ObjectName;

import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.Valve;
import org.apache.catalina.authenticator.SingleSignOn;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.ContainerBase;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.core.StandardEngine;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.core.StandardService;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.realm.DataSourceRealm;
import org.apache.catalina.realm.JDBCRealm;
import org.apache.catalina.realm.JNDIRealm;
import org.apache.catalina.realm.MemoryRealm;
import org.apache.catalina.realm.UserDatabaseRealm;
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.startup.ContextConfig;
import org.apache.catalina.startup.HostConfig;
import org.apache.catalina.util.LifecycleMBeanBase;
import org.apache.catalina.valves.AccessLogValve;
import org.apache.catalina.valves.RemoteAddrValve;
import org.apache.catalina.valves.RemoteHostValve;
import org.apache.catalina.valves.ValveBase;

/**
 *
A ModelMBean implementation for the
 * org.apache.catalina.core.StandardServer component.

 *
 * @author Amy Roh
 * @version $Id: MBeanFactory.java 1240334 2012-02-03 20:17:37Z markt $
 */

public class MBeanFactory {

    private static final org.apache.juli.logging.Log log =
        org.apache.juli.logging.LogFactory.getLog(MBeanFactory.class);

    /**
     * The MBeanServer for this application.
     */
    private static MBeanServer mserver = MBeanUtils.createServer();

    // ----------------------------------------------------------- Constructors

    /**
     * Construct a ModelMBean with default
     * ModelMBeanInfo information.
     *
     * @exception javax.management.MBeanException if the initializer of an
     *  object throws an exception
     * @exception javax.management.RuntimeOperationsException if an
     *  IllegalArgumentException occurs
     */
    public MBeanFactory() {

        super();

    }

    // ------------------------------------------------------------- Attributes

    /**
     * The container (Server/Service) for which this factory was created.
     */
    private Object container;

    // ------------------------------------------------------------- Operations

    /**
     * Set the container that this factory was created for.
     */
    public void setContainer(Object container) {
        this.container = container;
    }

    /**
     * Return the managed bean definition for the specified bean type
     *
     * @param type MBean type
     */
    public String findObjectName(String type) {

        if (type.equals("org.apache.catalina.core.StandardContext")) {
            return "StandardContext";
        } else if (type.equals("org.apache.catalina.core.StandardEngine")) {
            return "Engine";
        } else if (type.equals("org.apache.catalina.core.StandardHost")) {
            return "Host";
        } else {
            return null;
        }

    }

    /**
     * Little convenience method to remove redundant code
     * when retrieving the path string
     *
     * @param t path string
     * @return empty string if t==null || t.equals("/")
     */
    private final String getPathStr(String t) {
        if (t == null || t.equals("/")) {
            return "";
        }
        return t;
    }

   /**
     * Get Parent ContainerBase to add its child component
     * from parent's ObjectName
     */
    private ContainerBase getParentContainerFromParent(ObjectName pname)
        throws Exception {

        String type = pname.getKeyProperty("type");
        String j2eeType = pname.getKeyProperty("j2eeType");
        Service service = getService(pname);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if ((j2eeType!=null) && (j2eeType.equals("WebModule"))) {
            String name = pname.getKeyProperty("name");
            name = name.substring(2);
            int i = name.indexOf("/");
            String hostName = name.substring(0,i);
            String path = name.substring(i);
            Host host = (Host) engine.findChild(hostName);
            String pathStr = getPathStr(path);
            StandardContext context = (StandardContext)host.findChild(pathStr);
            return context;
        } else if (type != null) {
            if (type.equals("Engine")) {
                return engine;
            } else if (type.equals("Host")) {
                String hostName = pname.getKeyProperty("host");
                StandardHost host = (StandardHost) engine.findChild(hostName);
                return host;
            }
        }
        return null;

    }

    /**
     * Get Parent ContainerBase to add its child component
     * from child component's ObjectName  as a String
     */
    private ContainerBase getParentContainerFromChild(ObjectName oname)
        throws Exception {

        String hostName = oname.getKeyProperty("host");
        String path = oname.getKeyProperty("path");
        Service service = getService(oname);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if (hostName == null) {
            // child's container is Engine
            return engine;
        } else if (path == null) {
            // child's container is Host
            StandardHost host = (StandardHost) engine.findChild(hostName);
            return host;
        } else {
            // child's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            return context;
        }
    }

    private Service getService(ObjectName oname) throws Exception {

        if (container instanceof Service) {
            // Don't bother checking the domain - this is the only option
            return (Service) container;
        }

        StandardService service = null;
        String domain = oname.getDomain();
        if (container instanceof Server) {
            Service[] services = ((Server)container).findServices();
            for (int i = 0; i < services.length; i++) {
                service = (StandardService) services[i];
                if (domain.equals(service.getObjectName().getDomain())) {
                    break;
                }
            }
        }
        if (service == null ||
                !service.getObjectName().getDomain().equals(domain)) {
            throw new Exception("Service with the domain is not found");
        }
        return service;

    }

    /**
     * Create a new AccessLoggerValve.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     *
     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
     *              #createValve(String, String)}.
     */
    @Deprecated
    public String createAccessLoggerValve(String parent)
        throws Exception {

        ObjectName pname = new ObjectName(parent);
        // Create a new AccessLogValve instance
        AccessLogValve accessLogger = new AccessLogValve();
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.getPipeline().addValve(accessLogger);
        ObjectName oname = accessLogger.getObjectName();
        return (oname.toString());

    }

    /**
     * Create a new AjpConnector
     *
     * @param parent MBean Name of the associated parent component
     * @param address The IP address on which to bind
     * @param port TCP port number to listen on
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createAjpConnector(String parent, String address, int port)
        throws Exception {

        return createConnector(parent, address, port, true, false);
    }

    /**
     * Create a new DataSource Realm.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createDataSourceRealm(String parent, String dataSourceName,
        String roleNameCol, String userCredCol, String userNameCol,
        String userRoleTable, String userTable) throws Exception {

        // Create a new DataSourceRealm instance
        DataSourceRealm realm = new DataSourceRealm();
        realm.setDataSourceName(dataSourceName);
        realm.setRoleNameCol(roleNameCol);
        realm.setUserCredCol(userCredCol);
        realm.setUserNameCol(userNameCol);
        realm.setUserRoleTable(userRoleTable);
        realm.setUserTable(userTable);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.setRealm(realm);
        // Return the corresponding MBean name
        ObjectName oname = realm.getObjectName();
        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new HttpConnector
     *
     * @param parent MBean Name of the associated parent component
     * @param address The IP address on which to bind
     * @param port TCP port number to listen on
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createHttpConnector(String parent, String address, int port)
            throws Exception {
        return createConnector(parent, address, port, false, false);
    }

    /**
     * Create a new Connector
     *
     * @param parent MBean Name of the associated parent component
     * @param address The IP address on which to bind
     * @param port TCP port number to listen on
     * @param isAjp Create a AJP/1.3 Connector
     * @param isSSL Create a secure Connector
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    private String createConnector(String parent, String address, int port, boolean isAjp, boolean isSSL)
        throws Exception {
        Connector retobj = new Connector();
        if ((address!=null) && (address.length()>0)) {
            retobj.setProperty("address", address);
        }
        // Set port number
        retobj.setPort(port);
        // Set the protocol
        retobj.setProtocol(isAjp ? "AJP/1.3" : "HTTP/1.1");
        // Set SSL
        retobj.setSecure(isSSL);
        retobj.setScheme(isSSL ? "https" : "http");
        // Add the new instance to its parent component
        // FIX ME - addConnector will fail
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);
        service.addConnector(retobj);

        // Return the corresponding MBean name
        ObjectName coname = retobj.getObjectName();

        return (coname.toString());
    }

    /**
     * Create a new HttpsConnector
     *
     * @param parent MBean Name of the associated parent component
     * @param address The IP address on which to bind
     * @param port TCP port number to listen on
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createHttpsConnector(String parent, String address, int port)
        throws Exception {
        return createConnector(parent, address, port, false, true);
    }

    /**
     * Create a new JDBC Realm.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createJDBCRealm(String parent, String driverName,
        String connectionName, String connectionPassword, String connectionURL)
        throws Exception {

        // Create a new JDBCRealm instance
        JDBCRealm realm = new JDBCRealm();
        realm.setDriverName(driverName);
        realm.setConnectionName(connectionName);
        realm.setConnectionPassword(connectionPassword);
        realm.setConnectionURL(connectionURL);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.setRealm(realm);
        // Return the corresponding MBean name
        ObjectName oname = realm.getObjectName();

        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new JNDI Realm.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createJNDIRealm(String parent)
        throws Exception {

         // Create a new JNDIRealm instance
        JNDIRealm realm = new JNDIRealm();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.setRealm(realm);
        // Return the corresponding MBean name
        ObjectName oname = realm.getObjectName();

        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new Memory Realm.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createMemoryRealm(String parent)
        throws Exception {

         // Create a new MemoryRealm instance
        MemoryRealm realm = new MemoryRealm();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.setRealm(realm);
        // Return the corresponding MBean name
        ObjectName oname = realm.getObjectName();
        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new Remote Address Filter Valve.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     *
     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
     *              #createValve(String, String)}.
     */
    @Deprecated
    public String createRemoteAddrValve(String parent)
        throws Exception {

        // Create a new RemoteAddrValve instance
        RemoteAddrValve valve = new RemoteAddrValve();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        containerBase.getPipeline().addValve(valve);
        ObjectName oname = valve.getObjectName();
        return (oname.toString());

    }

     /**
     * Create a new Remote Host Filter Valve.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     *
     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
     *              #createValve(String, String)}.
     */
    @Deprecated
    public String createRemoteHostValve(String parent)
        throws Exception {

        // Create a new RemoteHostValve instance
        RemoteHostValve valve = new RemoteHostValve();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        containerBase.getPipeline().addValve(valve);
        ObjectName oname = valve.getObjectName();
        return (oname.toString());

    }

    /**
     * Create a new Single Sign On Valve.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     *
     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
     *              #createValve(String, String)}.
     */
    @Deprecated

    public String createSingleSignOn(String parent)
        throws Exception {

        // Create a new SingleSignOn instance
        SingleSignOn valve = new SingleSignOn();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        containerBase.getPipeline().addValve(valve);
        ObjectName oname = valve.getObjectName();
        return (oname.toString());

    }

   /**
     * Create a new StandardContext.
     *
     * @param parent MBean Name of the associated parent component
     * @param path The context path for this Context
     * @param docBase Document base directory (or WAR) for this Context
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createStandardContext(String parent,
                                        String path,
                                        String docBase)
        throws Exception {

        return createStandardContext(parent, path, docBase, false, false,
                false, false);
    }

   /**
     * Create a new StandardContext.
     *
     * @param parent MBean Name of the associated parent component
     * @param path The context path for this Context
     * @param docBase Document base directory (or WAR) for this Context
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createStandardContext(String parent,
                                        String path,
                                        String docBase,
                                        boolean xmlValidation,
                                        boolean xmlNamespaceAware,
                                        boolean tldValidation,
                                        boolean tldNamespaceAware)
        throws Exception {

        // Create a new StandardContext instance
        StandardContext context = new StandardContext();
        path = getPathStr(path);
        context.setPath(path);
        context.setDocBase(docBase);
        context.setXmlValidation(xmlValidation);
        context.setXmlNamespaceAware(xmlNamespaceAware);
        context.setTldValidation(tldValidation);
        context.setTldNamespaceAware(tldNamespaceAware);

        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ObjectName deployer = new ObjectName(pname.getDomain()+
                                             ":type=Deployer,host="+
                                             pname.getKeyProperty("host"));
        if(mserver.isRegistered(deployer)) {
            String contextName = context.getName();
            mserver.invoke(deployer, "addServiced",
                           new Object [] {contextName},
                           new String [] {"java.lang.String"});
            String configPath = (String)mserver.getAttribute(deployer,
                                                             "configBaseName");
            String baseName = context.getBaseName();
            File configFile = new File(new File(configPath), baseName+".xml");
            if (configFile.isFile()) {
                context.setConfigFile(configFile.toURI().toURL());
            }
            mserver.invoke(deployer, "manageApp",
                           new Object[] {context},
                           new String[] {"org.apache.catalina.Context"});
            mserver.invoke(deployer, "removeServiced",
                           new Object [] {contextName},
                           new String [] {"java.lang.String"});
        } else {
            log.warn("Deployer not found for "+pname.getKeyProperty("host"));
            Service service = getService(pname);
            Engine engine = (Engine) service.getContainer();
            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
            host.addChild(context);
        }

        // Return the corresponding MBean name
        return context.getObjectName().toString();

    }

    /**
     * Create a new StandardHost.
     *
     * @param parent MBean Name of the associated parent component
     * @param name Unique name of this Host
     * @param appBase Application base directory name
     * @param autoDeploy Should we auto deploy?
     * @param deployOnStartup Deploy on server startup?
     * @param deployXML Should we deploy Context XML config files property?
     * @param unpackWARs Should we unpack WARs when auto deploying?
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createStandardHost(String parent, String name,
                                     String appBase,
                                     boolean autoDeploy,
                                     boolean deployOnStartup,
                                     boolean deployXML,
                                     boolean unpackWARs)
        throws Exception {

        // Create a new StandardHost instance
        StandardHost host = new StandardHost();
        host.setName(name);
        host.setAppBase(appBase);
        host.setAutoDeploy(autoDeploy);
        host.setDeployOnStartup(deployOnStartup);
        host.setDeployXML(deployXML);
        host.setUnpackWARs(unpackWARs);

        // add HostConfig for active reloading
        HostConfig hostConfig = new HostConfig();
        host.addLifecycleListener(hostConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);
        Engine engine = (Engine) service.getContainer();
        engine.addChild(host);

        // Return the corresponding MBean name
        return (host.getObjectName().toString());

    }

    /**
     * Creates a new StandardService and StandardEngine.
     *
     * @param domain       Domain name for the container instance
     * @param defaultHost  Name of the default host to be used in the Engine
     * @param baseDir      Base directory value for Engine
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createStandardServiceEngine(String domain,
            String defaultHost, String baseDir) throws Exception{

        if (!(container instanceof Server)) {
            throw new Exception("Container not Server");
        }

        StandardEngine engine = new StandardEngine();
        engine.setDomain(domain);
        engine.setName(domain);
        engine.setDefaultHost(defaultHost);
        engine.setBaseDir(baseDir);

        Service service = new StandardService();
        service.setContainer(engine);
        service.setName(domain);

        ((Server) container).addService(service);

        return engine.getObjectName().toString();
    }

    /**
     * Create a new StandardManager.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createStandardManager(String parent)
        throws Exception {

        // Create a new StandardManager instance
        StandardManager manager = new StandardManager();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        if (containerBase != null) {
            containerBase.setManager(manager);
        }
        ObjectName oname = manager.getObjectName();
        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new  UserDatabaseRealm.
     *
     * @param parent MBean Name of the associated parent component
     * @param resourceName Global JNDI resource name of the associated
     *  UserDatabase
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createUserDatabaseRealm(String parent, String resourceName)
        throws Exception {

         // Create a new UserDatabaseRealm instance
        UserDatabaseRealm realm = new UserDatabaseRealm();
        realm.setResourceName(resourceName);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        // Add the new instance to its parent component
        containerBase.setRealm(realm);
        // Return the corresponding MBean name
        ObjectName oname = realm.getObjectName();
        // FIXME getObjectName() returns null
        //ObjectName oname =
        //    MBeanUtils.createObjectName(pname.getDomain(), realm);
        if (oname != null) {
            return (oname.toString());
        } else {
            return null;
        }

    }

    /**
     * Create a new Valve and associate it with a {@link Container}.
     *
     * @param className The fully qualified class name of the {@link Valve} to
     *                  create
     * @param parent    The MBean name of the associated parent
     *                  {@link Container}.
     *
     * @return  The MBean name of the {@link Valve} that was created or
     *          null if the {@link Valve} does not implement
     *          {@link LifecycleMBeanBase}.
     */
    public String createValve(String className, String parent)
            throws Exception {

        // Look for the parent
        ObjectName parentName = new ObjectName(parent);
        Container container = getParentContainerFromParent(parentName);

        if (container == null) {
            // TODO
            throw new IllegalArgumentException();
        }

        Valve valve = (Valve) Class.forName(className).newInstance();

        container.getPipeline().addValve(valve);

        if (valve instanceof LifecycleMBeanBase) {
            return ((LifecycleMBeanBase) valve).getObjectName().toString();
        } else {
            return null;
        }
    }

    /**
     * Create a new Web Application Loader.
     *
     * @param parent MBean Name of the associated parent component
     *
     * @exception Exception if an MBean cannot be created or registered
     */
    public String createWebappLoader(String parent)
        throws Exception {

        // Create a new WebappLoader instance
        WebappLoader loader = new WebappLoader();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        if (containerBase != null) {
            containerBase.setLoader(loader);
        }
        // FIXME add Loader.getObjectName
        //ObjectName oname = loader.getObjectName();
        ObjectName oname =
            MBeanUtils.createObjectName(pname.getDomain(), loader);
        return (oname.toString());

    }

    /**
     * Remove an existing Connector.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeConnector(String name) throws Exception {

        // Acquire a reference to the component to be removed
        ObjectName oname = new ObjectName(name);
        Service service = getService(oname);
        String port = oname.getKeyProperty("port");
        //String address = oname.getKeyProperty("address");

        Connector conns[] = service.findConnectors();

        for (int i = 0; i < conns.length; i++) {
            String connAddress = String.valueOf(conns[i].getProperty("address"));
            String connPort = ""+conns[i].getPort();

            // if (((address.equals("null")) &&
            if ((connAddress==null) && port.equals(connPort)) {
                service.removeConnector(conns[i]);
                conns[i].destroy();
                break;
            }
            // } else if (address.equals(connAddress))
            if (port.equals(connPort)) {
                // Remove this component from its parent component
                service.removeConnector(conns[i]);
                conns[i].destroy();
                break;
            }
        }

    }

    /**
     * Remove an existing Context.
     *
     * @param contextName MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeContext(String contextName) throws Exception {

        // Acquire a reference to the component to be removed
        ObjectName oname = new ObjectName(contextName);
        String domain = oname.getDomain();
        StandardService service = (StandardService) getService(oname);

        Engine engine = (Engine) service.getContainer();
        String name = oname.getKeyProperty("name");
        name = name.substring(2);
        int i = name.indexOf("/");
        String hostName = name.substring(0,i);
        String path = name.substring(i);
        ObjectName deployer = new ObjectName(domain+":type=Deployer,host="+
                                             hostName);
        String pathStr = getPathStr(path);
        if(mserver.isRegistered(deployer)) {
            mserver.invoke(deployer,"addServiced",
                           new Object[]{pathStr},
                           new String[] {"java.lang.String"});
            mserver.invoke(deployer,"unmanageApp",
                           new Object[] {pathStr},
                           new String[] {"java.lang.String"});
            mserver.invoke(deployer,"removeServiced",
                           new Object[] {pathStr},
                           new String[] {"java.lang.String"});
        } else {
            log.warn("Deployer not found for "+hostName);
            Host host = (Host) engine.findChild(hostName);
            Context context = (Context) host.findChild(pathStr);
            // Remove this component from its parent component
            host.removeChild(context);
            if(context instanceof StandardContext)
            try {
                ((StandardContext)context).destroy();
            } catch (Exception e) {
                log.warn("Error during context [" + context.getName() + "] destroy ", e);
           }

        }

    }

    /**
     * Remove an existing Host.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeHost(String name) throws Exception {

        // Acquire a reference to the component to be removed
        ObjectName oname = new ObjectName(name);
        String hostName = oname.getKeyProperty("host");
        Service service = getService(oname);
        Engine engine = (Engine) service.getContainer();
        Host host = (Host) engine.findChild(hostName);

        // Remove this component from its parent component
        if(host!=null) {
            engine.removeChild(host);
        }
    }

    /**
     * Remove an existing Loader.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeLoader(String name) throws Exception {

        ObjectName oname = new ObjectName(name);
        // Acquire a reference to the component to be removed
        ContainerBase container = getParentContainerFromChild(oname);
        container.setLoader(null);

    }

    /**
     * Remove an existing Manager.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeManager(String name) throws Exception {

        ObjectName oname = new ObjectName(name);
        // Acquire a reference to the component to be removed
        ContainerBase container = getParentContainerFromChild(oname);
        container.setManager(null);

    }

    /**
     * Remove an existing Realm.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeRealm(String name) throws Exception {

        ObjectName oname = new ObjectName(name);
        // Acquire a reference to the component to be removed
        ContainerBase container = getParentContainerFromChild(oname);
        container.setRealm(null);
    }

    /**
     * Remove an existing Service.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeService(String name) throws Exception {

        if (!(container instanceof Server)) {
            throw new Exception();
        }

        // Acquire a reference to the component to be removed
        ObjectName oname = new ObjectName(name);
        Service service = getService(oname);
        ((Server) container).removeService(service);
    }

    /**
     * Remove an existing Valve.
     *
     * @param name MBean Name of the component to remove
     *
     * @exception Exception if a component cannot be removed
     */
    public void removeValve(String name) throws Exception {

        // Acquire a reference to the component to be removed
        ObjectName oname = new ObjectName(name);
        ContainerBase container = getParentContainerFromChild(oname);
        Valve[] valves = container.getPipeline().getValves();
        for (int i = 0; i < valves.length; i++) {
            ObjectName voname = ((ValveBase) valves[i]).getObjectName();
            if (voname.equals(oname)) {
                container.getPipeline().removeValve(valves[i]);
            }
        }
    }

}


text:
"use strict";

module.exports = {
  verifyError: function(res, statusCode, error) {
    expect(res.statusCode).to.equal(statusCode);
    expect(res.headers['content-type']).to.equal('application/json; charset=utf-8');
    expect(res.body).to.be.an('object');
    expect(res.body).to.have.property('error');
    expect(res.body.error).to.equal(error);
  }
};


text:
using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;

namespace rasterCellSize
{
    class Program
    {
        private static LicenseInitializer m_AOLicenseInitializer = new rasterCellSize.LicenseInitializer();

        [STAThread()]
        static void Main(string[] args)
        {
            //ESRI License Initializer generated code.
            m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeAdvanced },
            new esriLicenseExtensionCode[] { });
            //ESRI License Initializer generated code.

            //Get a path to the raster workspace and create a RasterWorkspace object
            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesRaster.RasterWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
            IRasterWorkspace2 rasterWorkspace = (IRasterWorkspace2) workspaceFactory.OpenFromFile("\\\\Filepath\\ToRaster\\Folder", 0);
            IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset("DEM_Resample.tif");

            //Create a raster layer to get the raster object from it
            IRasterLayer rasterLayer = new RasterLayer();
            rasterLayer.CreateFromDataset(rasterDataset);
            IRaster raster = rasterLayer.Raster;

            //Get the raster properties so we can modify them later and get details about them if we so choose.
            IRasterProps rasterProps = raster as IRasterProps;
            double cellSize = 60;

            //Declate a new spatial reference if you want to change the spatial reference used.
            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironment();
            ISpatialReference2 srReference = srFactory.CreateProjectedCoordinateSystem(26917) as ISpatialReference2;

            //Create an IRasterGeometryProc object as this has the projectFast method we are looking for.
            IRasterGeometryProc rasterGeometryProc = new RasterGeometryProc();
            rasterGeometryProc.ProjectFast(rasterProps.SpatialReference, rstResamplingTypes.RSP_NearestNeighbor, ((object)cellSize), raster);

            //Create a new rasterBandCollection to store the raster in and save it there.
            IRasterBandCollection rasterBandCollection = raster as IRasterBandCollection;
            String outName = "NewImage.tif";

            String outType = "TIFF";
            rasterBandCollection.SaveAs(outName, ((IWorkspace)rasterWorkspace), outType);

            Console.WriteLine("DONE");
            Console.ReadLine();
            //Do not make any call to ArcObjects after ShutDownApplication()
            m_AOLicenseInitializer.ShutdownApplication();
        }
    }
}


text:
package org.apache.camel.component.servicenow;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public final class ServiceNowExceptionModel {
    private final String status;
    private final Map<String, String> error;

    public ServiceNowExceptionModel(
        @JsonProperty("status") String status,
        @JsonProperty("error") Map<String, String> error) {
        this.status = status;
        this.error = error;
    }

    public String getStatus() {
        return status;
    }

    public Map<String, String> getError() {
        return error;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

public class CreateDockTool : IMapEditorTool {
	private IndustryType type;
	private MapController mapController;

	public CreateDockTool(MapController mapController, IndustryType type) {
		this.type = type;
		this.mapController = mapController;
	}

	public IndustryType Type {
		get { return type; }
		set { type = value; }
	}

	public void Destory() {
	}

	public void RespondMouseLeftClick() {
		RaycastHit2D ray = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
		if (ray.collider != null && ray.collider.tag == "Node") {
			GameObject dockGO = mapController.AddDock(ray.collider.gameObject, type);
			GameObject.Find("MapEditorController").GetComponent<MapEditorController>().SelectOne(dockGO.GetComponent<DockVO>());
		}
	}

	public void RespondMouseLeftUp() {
	}

	public void RespondMouseMove(float x, float y) {
	}

	public void RespondMouseRightClick() {
	}

	public bool CanDestroy() {
		return true;
	}
}


text:
require "resume/cli/resume_node_types"

module Resume
  module CLI
    module ResumeNodeTypes
      RSpec.describe AlignValue do
        describe ".===" do
          context "when other has a length > 1" do
            let(:long_hash) { { align: 1, extra: 2 } }

            it "returns false" do
              expect(described_class === long_hash).to be false
            end
          end

          context "when other has length == 1 but key != :align" do
            let(:non_align_value) { { something_else: 1 } }

            it "returns false" do
              expect(described_class === non_align_value).to be false
            end
          end

          context "when other has length == 1 and :align is a String" do
            let(:align_value) { { align: "1" } }

            it "returns value" do
              expect(described_class === align_value).to be true
            end
          end
        end
      end

      RSpec.describe FontHash do
        describe ".===" do
          context "when other has a length > 1" do
            let(:long_hash) do
              { font: { foo: "foo" }, extra: { bar: "bar" } }
            end

            it "returns false" do
              expect(described_class === long_hash).to be false
            end
          end

          context "when other has length == 1 but key != :font" do
            let(:non_font_hash) do
              { something_else: { foo: "bar" } }
            end

            it "returns false" do
              expect(described_class === non_font_hash).to be false
            end
          end

          context "when other has length == 1, but :font != Hash of values" do
            let(:non_font_hash) { [:font, [1, 2, 3]] }

            it "returns false" do
              expect(described_class === non_font_hash).to be false
            end
          end

          context "when other has length == 1 and :font == Hash of values" do
            let(:font_hash) do
              { font: { foo: "bar" } }
            end

            it "returns true" do
              expect(described_class === font_hash).to be true
            end
          end
        end
      end

      RSpec.describe StylesArray do
        describe ".===" do
          context "when other has a length > 1" do
            let(:long_hash) do
              { styles: [1, 2, 3], extra: [4, 5, 6] }
            end

            it "returns false" do
              expect(described_class === long_hash).to be false
            end
          end

          context "when other has length == 1 but key != :styles" do
            let(:non_styles_array) { [:something_else, [1, 2, 3]] }

            it "returns false" do
              expect(described_class === non_styles_array).to be false
            end
          end

          context "when other has length == 1 but :styles != Array of values" do
            let(:non_styles_array) do
              { styles: { foo: "bar" } }
            end

            it "returns false" do
              expect(described_class === non_styles_array).to be false
            end
          end

          context "when other has length == 1 and :styles == Array of values" do
            let(:styles_array) do
              { styles: [1, 2, 3] }
            end

            it "returns true" do
              expect(described_class === styles_array).to be true
            end
          end
        end
      end
    end
  end
end


text:
"""MongoDB storage backend"""

from oslo.config import cfg
import pymongo

from ceilometer.alarm.storage import pymongo_base
from ceilometer.openstack.common import log
from ceilometer import storage
from ceilometer.storage.mongo import utils as pymongo_utils

cfg.CONF.import_opt('time_to_live', 'ceilometer.storage',
                    group="database")

LOG = log.getLogger(__name__)

class Connection(pymongo_base.Connection):
    """Put the alarm data into a MongoDB database."""

    CONNECTION_POOL = pymongo_utils.ConnectionPool()

    def __init__(self, url):

        # NOTE(jd) Use our own connection pooling on top of the Pymongo one.
        # We need that otherwise we overflow the MongoDB instance with new
        # connection since we instanciate a Pymongo client each time someone
        # requires a new storage connection.
        self.conn = self.CONNECTION_POOL.connect(url)

        # Require MongoDB 2.4 to use $setOnInsert
        if self.conn.server_info()['versionArray'] < [2, 4]:
            raise storage.StorageBadVersion("Need at least MongoDB 2.4")

        connection_options = pymongo.uri_parser.parse_uri(url)
        self.db = getattr(self.conn, connection_options['database'])
        if connection_options.get('username'):
            self.db.authenticate(connection_options['username'],
                                 connection_options['password'])

        # NOTE(jd) Upgrading is just about creating index, so let's do this
        # on connection to be sure at least the TTL is correcly updated if
        # needed.
        self.upgrade()

    def clear(self):
        self.conn.drop_database(self.db.name)
        # Connection will be reopened automatically if needed
        self.conn.close()


text:
package com.amazonaws.services.simpleemail.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * SendBounceRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SendBounceRequestMarshaller implements Marshaller<Request<SendBounceRequest>, SendBounceRequest> {

    public Request<SendBounceRequest> marshall(SendBounceRequest sendBounceRequest) {

        if (sendBounceRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<SendBounceRequest> request = new DefaultRequest<SendBounceRequest>(sendBounceRequest, "AmazonSimpleEmailService");
        request.addParameter("Action", "SendBounce");
        request.addParameter("Version", "2010-12-01");
        request.setHttpMethod(HttpMethodName.POST);

        if (sendBounceRequest.getOriginalMessageId() != null) {
            request.addParameter("OriginalMessageId", StringUtils.fromString(sendBounceRequest.getOriginalMessageId()));
        }

        if (sendBounceRequest.getBounceSender() != null) {
            request.addParameter("BounceSender", StringUtils.fromString(sendBounceRequest.getBounceSender()));
        }

        if (sendBounceRequest.getExplanation() != null) {
            request.addParameter("Explanation", StringUtils.fromString(sendBounceRequest.getExplanation()));
        }

        MessageDsn messageDsn = sendBounceRequest.getMessageDsn();
        if (messageDsn != null) {

            if (messageDsn.getReportingMta() != null) {
                request.addParameter("MessageDsn.ReportingMta", StringUtils.fromString(messageDsn.getReportingMta()));
            }

            if (messageDsn.getArrivalDate() != null) {
                request.addParameter("MessageDsn.ArrivalDate", StringUtils.fromDate(messageDsn.getArrivalDate()));
            }

            com.amazonaws.internal.SdkInternalList<ExtensionField> extensionFieldsList = (com.amazonaws.internal.SdkInternalList<ExtensionField>) messageDsn
                    .getExtensionFields();
            if (!extensionFieldsList.isEmpty() || !extensionFieldsList.isAutoConstruct()) {
                int extensionFieldsListIndex = 1;

                for (ExtensionField extensionFieldsListValue : extensionFieldsList) {

                    if (extensionFieldsListValue.getName() != null) {
                        request.addParameter("MessageDsn.ExtensionFields.member." + extensionFieldsListIndex + ".Name",
                                StringUtils.fromString(extensionFieldsListValue.getName()));
                    }

                    if (extensionFieldsListValue.getValue() != null) {
                        request.addParameter("MessageDsn.ExtensionFields.member." + extensionFieldsListIndex + ".Value",
                                StringUtils.fromString(extensionFieldsListValue.getValue()));
                    }
                    extensionFieldsListIndex++;
                }
            }
        }

        com.amazonaws.internal.SdkInternalList<BouncedRecipientInfo> bouncedRecipientInfoListList = (com.amazonaws.internal.SdkInternalList<BouncedRecipientInfo>) sendBounceRequest
                .getBouncedRecipientInfoList();
        if (!bouncedRecipientInfoListList.isEmpty() || !bouncedRecipientInfoListList.isAutoConstruct()) {
            int bouncedRecipientInfoListListIndex = 1;

            for (BouncedRecipientInfo bouncedRecipientInfoListListValue : bouncedRecipientInfoListList) {

                if (bouncedRecipientInfoListListValue.getRecipient() != null) {
                    request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".Recipient",
                            StringUtils.fromString(bouncedRecipientInfoListListValue.getRecipient()));
                }

                if (bouncedRecipientInfoListListValue.getRecipientArn() != null) {
                    request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientArn",
                            StringUtils.fromString(bouncedRecipientInfoListListValue.getRecipientArn()));
                }

                if (bouncedRecipientInfoListListValue.getBounceType() != null) {
                    request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".BounceType",
                            StringUtils.fromString(bouncedRecipientInfoListListValue.getBounceType()));
                }

                RecipientDsnFields recipientDsnFields = bouncedRecipientInfoListListValue.getRecipientDsnFields();
                if (recipientDsnFields != null) {

                    if (recipientDsnFields.getFinalRecipient() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.FinalRecipient",
                                StringUtils.fromString(recipientDsnFields.getFinalRecipient()));
                    }

                    if (recipientDsnFields.getAction() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.Action",
                                StringUtils.fromString(recipientDsnFields.getAction()));
                    }

                    if (recipientDsnFields.getRemoteMta() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.RemoteMta",
                                StringUtils.fromString(recipientDsnFields.getRemoteMta()));
                    }

                    if (recipientDsnFields.getStatus() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.Status",
                                StringUtils.fromString(recipientDsnFields.getStatus()));
                    }

                    if (recipientDsnFields.getDiagnosticCode() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.DiagnosticCode",
                                StringUtils.fromString(recipientDsnFields.getDiagnosticCode()));
                    }

                    if (recipientDsnFields.getLastAttemptDate() != null) {
                        request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex + ".RecipientDsnFields.LastAttemptDate",
                                StringUtils.fromDate(recipientDsnFields.getLastAttemptDate()));
                    }

                    com.amazonaws.internal.SdkInternalList<ExtensionField> extensionFieldsList = (com.amazonaws.internal.SdkInternalList<ExtensionField>) recipientDsnFields
                            .getExtensionFields();
                    if (!extensionFieldsList.isEmpty() || !extensionFieldsList.isAutoConstruct()) {
                        int extensionFieldsListIndex = 1;

                        for (ExtensionField extensionFieldsListValue : extensionFieldsList) {

                            if (extensionFieldsListValue.getName() != null) {
                                request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex
                                        + ".RecipientDsnFields.ExtensionFields.member." + extensionFieldsListIndex + ".Name",
                                        StringUtils.fromString(extensionFieldsListValue.getName()));
                            }

                            if (extensionFieldsListValue.getValue() != null) {
                                request.addParameter("BouncedRecipientInfoList.member." + bouncedRecipientInfoListListIndex
                                        + ".RecipientDsnFields.ExtensionFields.member." + extensionFieldsListIndex + ".Value",
                                        StringUtils.fromString(extensionFieldsListValue.getValue()));
                            }
                            extensionFieldsListIndex++;
                        }
                    }
                }
                bouncedRecipientInfoListListIndex++;
            }
        }

        if (sendBounceRequest.getBounceSenderArn() != null) {
            request.addParameter("BounceSenderArn", StringUtils.fromString(sendBounceRequest.getBounceSenderArn()));
        }

        return request;
    }

}


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

$lang['site_broken'] = 'Oops! Looks like something was broken!';
$lang['site_about'] = 'About';
$lang['site_recognition'] = 'Recognition';
$lang['site_view'] = 'View';


text:
Hello World!

      WARNING: I can't run Javascript.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.angrygoat</groupId>
		<artifactId>policy-domains</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>
	<artifactId>domain-machine</artifactId>
	<name>Domain Machine</name>
	<description>Supporting foundation classes for policy-domain system</description>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.statemachine</groupId>
			<artifactId>spring-statemachine-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.statemachine</groupId>
			<artifactId>spring-statemachine-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.integration</groupId>
			<artifactId>spring-integration-core</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<debug>true</debug>
				</configuration>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins />

		</pluginManagement>
	</build>
</project>


text:
require 'spec_helper'

describe ConfidenceWeighted do
  it 'should have a version number' do
    ConfidenceWeighted::VERSION.should_not be_nil
  end
end


text:
var Helpers = require('./../helpers');

describe('product page', function () {

    var helpers = new Helpers();

    it('should display product link and go to products list after click it', function () {
        helpers.get('shops/shop1');
        expect(browser.getCurrentUrl()).toContain('shop1');
        var btnProducts = element(by.css('.products-list'));
        expect(btnProducts.isDisplayed()).toBe(true);
        expect(btnProducts.getText()).toBe('nasze produkty');
        btnProducts.click();

        browser.wait(function () {
            return browser.getCurrentUrl().then(function (url) {
                return /items/.test(url);
            });
        }, helpers.timeOut, 'It\'s taking too long to load url !');

        expect(browser.getCurrentUrl()).toContain('items');
    })

});


text:
package net.catchpole.silicone.lang;

//   Copyright 2014 catchpole.net
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public final class Spool {
    private final byte[] spoolBuffer;

    public Spool() {
        this(4096);
    }

    public Spool(int bufferSize) {
        this.spoolBuffer = new byte[bufferSize];
    }

    public Spool(byte[] spoolBuffer) {
        this.spoolBuffer = spoolBuffer;
    }

    public void spool(InputStream is, OutputStream os) throws IOException {
        int l;
        while ((l = is.read(spoolBuffer, 0, spoolBuffer.length)) != -1) {
            os.write(spoolBuffer, 0, l);
        }
    }

    public byte[] spoolToByteArray(InputStream is) throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(spoolBuffer.length);
        this.spool(is, baos);
        return baos.toByteArray();
    }

    public void spoolLimited(InputStream is, OutputStream os, long limit) throws IOException {
        int l;
        limit++; // spooling exactly limit allowed. fail at limit + 1
        while ((l = is.read(spoolBuffer, 0, spoolBuffer.length < limit ? spoolBuffer.length : (int)limit)) != -1) {
            if ((limit -= l) <= 0) {
                throw new IOException("spooling limit reached");
            }
            os.write(spoolBuffer, 0, l);
        }
    }
}


text:
import { IDomainEvent } from './IDomainEvent';

import { Guard } from '../utils/Guard';

export class DomainEvent implements IDomainEvent {
  constructor(
    readonly id : string | number,
    readonly aggregateId : string | number,
    readonly name : string,
    readonly data : any,
    readonly sequenceNumber : number) {
      Guard.againstUndefined(id, 'DomainEvent.ts-id');
      Guard.againstUndefined(aggregateId, 'DomainEvent.ts-aggregateId');
      Guard.againstUndefined(name, 'DomainEvent.ts-name');
      Guard.againstUndefined(data, 'DomainEvent.ts-data');
      Guard.againstUndefined(sequenceNumber, 'DomainEvent.ts-sequenceNumber');
    }
}