text:
Backbone.Collection.prototype.save = function(options) {
debugger;
  var promises = [], newModels = [], newModelsAttrs = [], changedModels = [], changedModelsAttrs = [];
  options = options || {};

  this.each(function(model){
  	if(model.isNew()){
  		newModels.push(model);
  		newModelsAttrs.push(model.toJSON());
  	}
  	else if(model.hasChanged()){
  		changedModels.push(model);
  		changedModelsAttrs.push(model.toJSON());
  	}
  });

  // After a successful server-side save, the collection will be
  // updated with the server-side state (using .set())
  if (options.parse === void 0) options.parse = true;
  if (options.remove === void 0) options.remove = false;

  var optionsNew     = _.clone(options) || {};
  var optionsChanged = _.clone(options) || {};

  optionsNew.url     = this.url;
  optionsChanged.url = this.url + "/" + _.pluck(changedModelsAttrs, "id").join(",");

  var collection = this;

  // make sure the promises array always has 2 promises (even if one of them is a "dummy promise")

  promises.push(newModels.length > 0 ?
				this.sync("create", this, _.extend(optionsNew, {attrs: newModelsAttrs})) :
				Q(undefined));

  promises.push(changedModels.length > 0 ?
				this.sync("update", this, _.extend(optionsChanged, {attrs: changedModelsAttrs})) :
				Q(undefined));

  // TODO: is there are no new or changed models, what should we do? return a fulfilled promise? or return false?

  var promise = Q.all(promises)
  				.then(
  					function(resp){
  						debugger;

  						// NOTE: if there are no new models, the corresponding promise in the "promises"
  						// array will already be resolved (with undefined)

  						// the first entry in the resp array is the fulfillment value of the promise
  						// relative to the new models
						if(resp[0]){

							// we have to update the models' attributes directly (instead of using collection's
							// set); otherwise we end up having duplicate models in the collection (because the
							// models that are currently present don't have yet an id, so the set() method
							// will create new ones)
  							var model;
							for(var i=0, l=resp[0].length; i<l; i++){
								model = newModels[i];
								model.set(model.parse(resp[0][i]), options);
							}

					        if (options.success){ options.success(collection, resp[0], options); }
					        collection.trigger('sync', collection, resp[0], options);
						}

  						// the second entry is the fulfillment value relative to the existing models
  						// (models that have been updated); here we can use collection's set()
						if(resp[1]){
							collection.set(resp[1], options);

					        if (options.success){ options.success(collection, resp[1], options); }
					        collection.trigger('sync', collection, resp[1], options);
						}
  					},
  					function(err){
  						debugger;
					    if (options.error) options.error(collection, resp, options);
					    collection.trigger('error', collection, resp, options);
  					}
  				)

	return promise;
};


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.12
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */

// source: goctp.i

#ifndef SWIG_goctp_WRAP_H_
#define SWIG_goctp_WRAP_H_

class Swig_memory;

class SwigDirector_CThostFtdcMdSpi : public CThostFtdcMdSpi
{
 public:
  SwigDirector_CThostFtdcMdSpi(int swig_p);
  void _swig_upcall_OnFrontConnected() {
    CThostFtdcMdSpi::OnFrontConnected();
  }
  virtual void OnFrontConnected();
  void _swig_upcall_OnFrontDisconnected(int nReason) {
    CThostFtdcMdSpi::OnFrontDisconnected(nReason);
  }
  virtual void OnFrontDisconnected(int nReason);
  void _swig_upcall_OnHeartBeatWarning(int nTimeLapse) {
    CThostFtdcMdSpi::OnHeartBeatWarning(nTimeLapse);
  }
  virtual void OnHeartBeatWarning(int nTimeLapse);
  void _swig_upcall_OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspUserLogin(pRspUserLogin,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspUserLogout(pUserLogout,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspError(pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspSubMarketData(pSpecificInstrument,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspUnSubMarketData(pSpecificInstrument,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspSubForQuoteRsp(pSpecificInstrument,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcMdSpi::OnRspUnSubForQuoteRsp(pSpecificInstrument,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {
    CThostFtdcMdSpi::OnRtnDepthMarketData(pDepthMarketData);
  }
  virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData);
  void _swig_upcall_OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {
    CThostFtdcMdSpi::OnRtnForQuoteRsp(pForQuoteRsp);
  }
  virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp);
 private:
  intgo go_val;
  Swig_memory *swig_mem;
};

class SwigDirector_CThostFtdcTraderSpi : public CThostFtdcTraderSpi
{
 public:
  SwigDirector_CThostFtdcTraderSpi(int swig_p);
  void _swig_upcall_OnFrontConnected() {
    CThostFtdcTraderSpi::OnFrontConnected();
  }
  virtual void OnFrontConnected();
  void _swig_upcall_OnFrontDisconnected(int nReason) {
    CThostFtdcTraderSpi::OnFrontDisconnected(nReason);
  }
  virtual void OnFrontDisconnected(int nReason);
  void _swig_upcall_OnHeartBeatWarning(int nTimeLapse) {
    CThostFtdcTraderSpi::OnHeartBeatWarning(nTimeLapse);
  }
  virtual void OnHeartBeatWarning(int nTimeLapse);
  void _swig_upcall_OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspAuthenticate(pRspAuthenticateField,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspUserLogin(pRspUserLogin,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspUserLogout(pUserLogout,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspUserPasswordUpdate(pUserPasswordUpdate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspTradingAccountPasswordUpdate(pTradingAccountPasswordUpdate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspOrderInsert(pInputOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspParkedOrderInsert(pParkedOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspParkedOrderAction(pParkedOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspOrderAction(pInputOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQueryMaxOrderVolume(pQueryMaxOrderVolume,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspSettlementInfoConfirm(pSettlementInfoConfirm,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspRemoveParkedOrder(pRemoveParkedOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspRemoveParkedOrderAction(pRemoveParkedOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspExecOrderInsert(pInputExecOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspExecOrderAction(pInputExecOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspForQuoteInsert(pInputForQuote,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQuoteInsert(pInputQuote,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQuoteAction(pInputQuoteAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspBatchOrderAction(pInputBatchOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspCombActionInsert(pInputCombAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryOrder(pOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTrade(pTrade,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInvestorPosition(pInvestorPosition,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTradingAccount(pTradingAccount,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInvestor(pInvestor,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTradingCode(pTradingCode,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInstrumentMarginRate(pInstrumentMarginRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInstrumentCommissionRate(pInstrumentCommissionRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryExchange(pExchange,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryProduct(pProduct,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInstrument(pInstrument,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryDepthMarketData(pDepthMarketData,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQrySettlementInfo(pSettlementInfo,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTransferBank(pTransferBank,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInvestorPositionDetail(pInvestorPositionDetail,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryNotice(pNotice,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQrySettlementInfoConfirm(pSettlementInfoConfirm,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInvestorPositionCombineDetail(pInvestorPositionCombineDetail,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryCFMMCTradingAccountKey(pCFMMCTradingAccountKey,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryEWarrantOffset(pEWarrantOffset,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInvestorProductGroupMargin(pInvestorProductGroupMargin,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryExchangeMarginRate(pExchangeMarginRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryExchangeMarginRateAdjust(pExchangeMarginRateAdjust,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryExchangeRate(pExchangeRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQrySecAgentACIDMap(pSecAgentACIDMap,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryProductExchRate(pProductExchRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryProductGroup(pProductGroup,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryMMInstrumentCommissionRate(CThostFtdcMMInstrumentCommissionRateField *pMMInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryMMInstrumentCommissionRate(pMMInstrumentCommissionRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryMMInstrumentCommissionRate(CThostFtdcMMInstrumentCommissionRateField *pMMInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryMMOptionInstrCommRate(CThostFtdcMMOptionInstrCommRateField *pMMOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryMMOptionInstrCommRate(pMMOptionInstrCommRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryMMOptionInstrCommRate(CThostFtdcMMOptionInstrCommRateField *pMMOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField *pInstrumentOrderCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryInstrumentOrderCommRate(pInstrumentOrderCommRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField *pInstrumentOrderCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryOptionInstrTradeCost(pOptionInstrTradeCost,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryOptionInstrCommRate(pOptionInstrCommRate,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryExecOrder(pExecOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryForQuote(pForQuote,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryQuote(pQuote,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryCombInstrumentGuard(pCombInstrumentGuard,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryCombAction(CThostFtdcCombActionField *pCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryCombAction(pCombAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryCombAction(CThostFtdcCombActionField *pCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTransferSerial(pTransferSerial,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryAccountregister(pAccountregister,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspError(pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRtnOrder(CThostFtdcOrderField *pOrder) {
    CThostFtdcTraderSpi::OnRtnOrder(pOrder);
  }
  virtual void OnRtnOrder(CThostFtdcOrderField *pOrder);
  void _swig_upcall_OnRtnTrade(CThostFtdcTradeField *pTrade) {
    CThostFtdcTraderSpi::OnRtnTrade(pTrade);
  }
  virtual void OnRtnTrade(CThostFtdcTradeField *pTrade);
  void _swig_upcall_OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnOrderInsert(pInputOrder,pRspInfo);
  }
  virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnOrderAction(pOrderAction,pRspInfo);
  }
  virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {
    CThostFtdcTraderSpi::OnRtnInstrumentStatus(pInstrumentStatus);
  }
  virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus);
  void _swig_upcall_OnRtnBulletin(CThostFtdcBulletinField *pBulletin) {
    CThostFtdcTraderSpi::OnRtnBulletin(pBulletin);
  }
  virtual void OnRtnBulletin(CThostFtdcBulletinField *pBulletin);
  void _swig_upcall_OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {
    CThostFtdcTraderSpi::OnRtnTradingNotice(pTradingNoticeInfo);
  }
  virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo);
  void _swig_upcall_OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {
    CThostFtdcTraderSpi::OnRtnErrorConditionalOrder(pErrorConditionalOrder);
  }
  virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder);
  void _swig_upcall_OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder) {
    CThostFtdcTraderSpi::OnRtnExecOrder(pExecOrder);
  }
  virtual void OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder);
  void _swig_upcall_OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnExecOrderInsert(pInputExecOrder,pRspInfo);
  }
  virtual void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnExecOrderAction(pExecOrderAction,pRspInfo);
  }
  virtual void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnForQuoteInsert(pInputForQuote,pRspInfo);
  }
  virtual void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRtnQuote(CThostFtdcQuoteField *pQuote) {
    CThostFtdcTraderSpi::OnRtnQuote(pQuote);
  }
  virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote);
  void _swig_upcall_OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnQuoteInsert(pInputQuote,pRspInfo);
  }
  virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnQuoteAction(pQuoteAction,pRspInfo);
  }
  virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {
    CThostFtdcTraderSpi::OnRtnForQuoteRsp(pForQuoteRsp);
  }
  virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp);
  void _swig_upcall_OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {
    CThostFtdcTraderSpi::OnRtnCFMMCTradingAccountToken(pCFMMCTradingAccountToken);
  }
  virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken);
  void _swig_upcall_OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField *pBatchOrderAction, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnBatchOrderAction(pBatchOrderAction,pRspInfo);
  }
  virtual void OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField *pBatchOrderAction, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {
    CThostFtdcTraderSpi::OnRtnCombAction(pCombAction);
  }
  virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction);
  void _swig_upcall_OnErrRtnCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnCombActionInsert(pInputCombAction,pRspInfo);
  }
  virtual void OnErrRtnCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryContractBank(pContractBank,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryParkedOrder(pParkedOrder,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryParkedOrderAction(pParkedOrderAction,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryTradingNotice(pTradingNotice,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryBrokerTradingParams(pBrokerTradingParams,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQryBrokerTradingAlgos(pBrokerTradingAlgos,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQueryCFMMCTradingAccountToken(pQueryCFMMCTradingAccountToken,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer) {
    CThostFtdcTraderSpi::OnRtnFromBankToFutureByBank(pRspTransfer);
  }
  virtual void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer);
  void _swig_upcall_OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer) {
    CThostFtdcTraderSpi::OnRtnFromFutureToBankByBank(pRspTransfer);
  }
  virtual void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer);
  void _swig_upcall_OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromBankToFutureByBank(pRspRepeal);
  }
  virtual void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromFutureToBankByBank(pRspRepeal);
  }
  virtual void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer) {
    CThostFtdcTraderSpi::OnRtnFromBankToFutureByFuture(pRspTransfer);
  }
  virtual void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer);
  void _swig_upcall_OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer) {
    CThostFtdcTraderSpi::OnRtnFromFutureToBankByFuture(pRspTransfer);
  }
  virtual void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer);
  void _swig_upcall_OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromBankToFutureByFutureManual(pRspRepeal);
  }
  virtual void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromFutureToBankByFutureManual(pRspRepeal);
  }
  virtual void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount) {
    CThostFtdcTraderSpi::OnRtnQueryBankBalanceByFuture(pNotifyQueryAccount);
  }
  virtual void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount);
  void _swig_upcall_OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnBankToFutureByFuture(pReqTransfer,pRspInfo);
  }
  virtual void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnFutureToBankByFuture(pReqTransfer,pRspInfo);
  }
  virtual void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnRepealBankToFutureByFutureManual(pReqRepeal,pRspInfo);
  }
  virtual void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnRepealFutureToBankByFutureManual(pReqRepeal,pRspInfo);
  }
  virtual void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo) {
    CThostFtdcTraderSpi::OnErrRtnQueryBankBalanceByFuture(pReqQueryAccount,pRspInfo);
  }
  virtual void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo);
  void _swig_upcall_OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromBankToFutureByFuture(pRspRepeal);
  }
  virtual void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal) {
    CThostFtdcTraderSpi::OnRtnRepealFromFutureToBankByFuture(pRspRepeal);
  }
  virtual void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal);
  void _swig_upcall_OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspFromBankToFutureByFuture(pReqTransfer,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspFromFutureToBankByFuture(pReqTransfer,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
    CThostFtdcTraderSpi::OnRspQueryBankAccountMoneyByFuture(pReqQueryAccount,pRspInfo,nRequestID,bIsLast);
  }
  virtual void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
  void _swig_upcall_OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount) {
    CThostFtdcTraderSpi::OnRtnOpenAccountByBank(pOpenAccount);
  }
  virtual void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount);
  void _swig_upcall_OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount) {
    CThostFtdcTraderSpi::OnRtnCancelAccountByBank(pCancelAccount);
  }
  virtual void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount);
  void _swig_upcall_OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount) {
    CThostFtdcTraderSpi::OnRtnChangeAccountByBank(pChangeAccount);
  }
  virtual void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount);
 private:
  intgo go_val;
  Swig_memory *swig_mem;
};

#endif

redpajama_set_name: RedPajamaGithub


text: Log directory


text:
#import "TiProxy.h"

@interface Ti2DMatrix : TiProxy {
@protected
	CGAffineTransform matrix;
}

-(id)initWithProperties:(NSDictionary*)dict_;
-(id)initWithMatrix:(CGAffineTransform)matrix_;

-(CGAffineTransform)matrix;
-(Ti2DMatrix*)translate:(id)args;
-(Ti2DMatrix*)scale:(id)args;
-(Ti2DMatrix*)rotate:(id)args;
-(Ti2DMatrix*)invert:(id)args;
-(Ti2DMatrix*)multiply:(id)args;

@property(nonatomic,readwrite,retain) NSNumber* a;
@property(nonatomic,readwrite,retain) NSNumber* b;
@property(nonatomic,readwrite,retain) NSNumber* c;
@property(nonatomic,readwrite,retain) NSNumber* d;
@property(nonatomic,readwrite,retain) NSNumber* tx;
@property(nonatomic,readwrite,retain) NSNumber* ty;

@end


text:
'use strict';

/**
 * @ngdoc function
 * @name uilightPaginationApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the uilightPaginationApp
 */
angular.module('uilightPaginationApp')
  .controller('MainCtrl', function ($scope, demoService) {
    this.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];

    $scope.List = {
        conf: {
            serverSide: false
        },
        totalList: [],
        loadData: function () {
            demoService.getData().then(
                function (res) {
                    $scope.List.totalList = res; //非serverSide直接返回Array
                },
                function (err) {
                }
            );
        },
        setting: {
            page: 1,
            row: 5
        },
        refresh: function () {
            $scope.List.totalList = undefined; //清空
            $scope.List.loadData(); //重新请求
        }
    }

    $scope.List.refresh();

  });


text:
def Setup(Settings, DefaultModel):
    # set4a_min-edge-datasets-tests/set4a_MinEdgeSize_mix_len10_kfold_d5.py

    Settings["experiment_name"] = "set4a_MinEdgeSize_mix_len10_kfold_d5"

    Settings["graph_histories"] = []  # ['all','together',[],[1,0],[0,0,0],[]]
    n = 0

    #d1 5556x_markable_640x640                SegmentsData_marked_R100_4Tables
    #d2 5556x_markable_640x640_2x_expanded    SegmentsData_marked_R100_4Tables_expanded.dump
    #d3 5556x_minlen30_640px                  SegmentsData_marked_R100_4Tables.dump
    #d4 5556x_minlen30_640px_2x_expanded      SegmentsData_marked_R100_4Tables_expanded.dump

    #d5 5556x_minlen10_640px                  SegmentsData_marked_R100_4Tables.dump
    #d6 5556x_minlen20_640px                  SegmentsData_marked_R100_4Tables.dump

    Settings["models"][n]["dataset_name"] = "5556x_minlen10_640px"
    Settings["models"][n]["dump_file_override"] = 'SegmentsData_marked_R100_4Tables.dump'
    Settings["models"][n]["pixels"] = 640
    Settings["models"][n]["model_type"] = 'img_osm_mix' # osm_only img_only img_osm_mix
    Settings["models"][n]["unique_id"] = 'mix_with_min10'
    Settings["models"][n]["top_repeat_FC_block"] = 2
    Settings["models"][n]["epochs"] = 500

    Settings["models"][n]["k_fold_crossvalidation"] = True
    Settings["models"][n]["crossvalidation_k"] = 10

    Settings["graph_histories"] = []

    return Settings


text:
package io.fabric8.updatebot.support;

import com.fasterxml.jackson.databind.JsonNode;

/**
 * Helper assertions for dealing with JSON or YAML markup
 */
public class JsonNodes {

    public static JsonNode path(JsonNode tree, String... paths) {
        JsonNode node = tree;
        for (String path : paths) {
            if (node == null || !node.isObject()) {
                return null;
            }
            node = node.get(path);
        }
        return node;
    }

    /**
     * Returns the text value of the given field on an object or null if its not a value or the value is not a string
     */
    public static String textValue(JsonNode node, String field) {
        JsonNode value = node.get(field);
        if (value != null && value.isTextual()) {
            return value.textValue();
        }
        return null;
    }
}


text:
#ifndef OOAOFOOA_TE_TRACE_CLASS_H
#define OOAOFOOA_TE_TRACE_CLASS_H

#ifdef	__cplusplus
extern	"C"	{
#endif

/*
 * Structural representation of application analysis class:
 *   trace  (TE_TRACE)
 */
struct ooaofooa_TE_TRACE {

  /* application analysis class attributes */
  c_t component_msg_start[ESCHER_SYS_MAX_STRING_LEN];
  c_t component_msg_end[ESCHER_SYS_MAX_STRING_LEN];
  c_t state_txn_start[ESCHER_SYS_MAX_STRING_LEN];
  c_t state_txn_end[ESCHER_SYS_MAX_STRING_LEN];
  c_t state_txn_event_ignored[ESCHER_SYS_MAX_STRING_LEN];
  c_t state_txn_cant_happen[ESCHER_SYS_MAX_STRING_LEN];
  c_t oal_trace[ESCHER_SYS_MAX_STRING_LEN];

};
void ooaofooa_TE_TRACE_instancedumper( Escher_iHandle_t );
Escher_iHandle_t ooaofooa_TE_TRACE_instanceloader( Escher_iHandle_t, const c_t * [] );
/* Allow reference to this function name but cause it to resolve to 0.  */
#define ooaofooa_TE_TRACE_batch_relate 0

#define ooaofooa_TE_TRACE_MAX_EXTENT_SIZE 10
extern Escher_Extent_t pG_ooaofooa_TE_TRACE_extent;

#ifdef	__cplusplus
}
#endif

#endif  /* OOAOFOOA_TE_TRACE_CLASS_H */


text:
<!DOCTYPE html>

    <title>FisFinder120</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">

Cerrar Sesión

        Herramientas

            Mi Cuenta
            Ver Usuarios
            Ver Administradores
            Acerca de

        Contenidos

            Agregar
            Eliminar

        Módulos

            Convergente
            Divergente
            Asimilador
            Adaptador

        Administrar Cuentas

            Crear nuevo Administrador
            Eliminar una Cuenta
            Modificar una Cuenta

Consultar Feedback

FisFinder 120

 a

 a

 Sesión Iniciada:

{{PROFESOR}}

 Administrador

Noticias

3 Nuevos Feedback

2 Nuevos Usuarios

 a

Fisica General II

Profesor Maximiliano Rivera

UTFSM CSJ


text:
module Licensee
  module Matchers
    class Dice
      attr_reader :file

      def initialize(file)
        @file = file
      end

      # Return the first potential license that is more similar
      # than the confidence threshold
      def match
        @match ||= if matches.empty?
          nil
        else
          matches.first[0]
        end
      end

      # Licenses that may be a match for this file.
      # To avoid false positives:
      #
      # 1. Creative commons licenses cannot be matched against license files
      #    that begin with the title of a non-open source CC license variant
      # 2. The percentage change in file length may not exceed the inverse
      #    of the confidence threshold
      def potential_licenses
        @potential_licenses ||= begin
          Licensee.licenses(hidden: true).select do |license|
            if license.creative_commons? && file.potential_false_positive?
              false
            else
              license.wordset && license.length_delta(file) <= license.max_delta
            end
          end
        end
      end

      def licenses_by_similiarity
        @licenses_by_similiarity ||= begin
          licenses = potential_licenses.map do |license|
            [license, license.similarity(file)]
          end
          licenses.sort_by { |_, similarity| similarity }.reverse
        end
      end

      def matches
        @matches ||= licenses_by_similiarity.select do |_, similarity|
          similarity >= Licensee.confidence_threshold
        end
      end

      # Confidence that the matched license is a match
      def confidence
        @confidence ||= match ? file.similarity(match) : 0
      end
    end
  end
end


text:
![cover](https://img1.doubanio.com/view/subject/l/public/s28390838.jpg)

    作者: Jonathan McAllister
    出版社: Packt Publishing
    副标题: Configure and extend Jenkins to architect, build, and automate efficient software delivery pipelines
    出版年: 2015-10-27
    页数: 334
    定价: USD 35.99
    装帧: Paperback
    ISBN: 9781784390891

[豆瓣链接](https://book.douban.com/subject/26715927/)

- [Distributed Builds – Master Slave Mode](#distributed-builds-%e2%80%93-master-slave-mode)
  - [Understanding the master and slave architecture](#understanding-the-master-and-slave-architecture)
  - [Choosing a launch method](#choosing-a-launch-method)
    - [Slave agents via SSH tunneling](#slave-agents-via-ssh-tunneling)
  - [Administering Jenkins slaves](#administering-jenkins-slaves)
    - [The node administration dashboard](#the-node-administration-dashboard)
    - [Preventative monitoring](#preventative-monitoring)
    - [Managing individual slave nodes](#managing-individual-slave-nodes)
  - [Labels, groups, and load balancing](#labels-groups-and-load-balancing)
    - [Attaching a slave to a group by creating a label](#attaching-a-slave-to-a-group-by-creating-a-label)
    - [Attaching a slave to many groups](#attaching-a-slave-to-many-groups)
    - [Restricting slave execution to global or tied jobs](#restricting-slave-execution-to-global-or-tied-jobs)
    - [Jenkins plugins that support distributed builds](#jenkins-plugins-that-support-distributed-builds)
- [Creating Views and Jobs in Jenkins](#creating-views-and-jobs-in-jenkins)
  - [Jobs in Jenkins](#jobs-in-jenkins)
- [Advanced Automated Testing](#advanced-automated-testing)
  - [Quality assurance initiatives and test automation terminology](#quality-assurance-initiatives-and-test-automation-terminology)
  - [The Software Development Lifecycle](#the-software-development-lifecycle)
  - [Connecting product codes to tests](#connecting-product-codes-to-tests)
  - [Baking quality into the product](#baking-quality-into-the-product)
    - [Smoke test tip](#smoke-test-tip)
  - [Distributed testing solutions](#distributed-testing-solutions)
- [Software Deployments and Delivery](#software-deployments-and-delivery)
  - [Standardizing build outputs](#standardizing-build-outputs)
    - [Architecting a packaging scheme](#architecting-a-packaging-scheme)
    - [Build and deployment best practice](#build-and-deployment-best-practice)
    - [Snapshots and Releases Tip](#snapshots-and-releases-tip)
  - [Implementing a Definitive Media Library](#implementing-a-definitive-media-library)
    - [Publishing assets to a DML](#publishing-assets-to-a-dml)
      - [JENKINS' ARCHIVE THE ARTIFACTS POST-BUILD ACTION](#jenkins-archive-the-artifacts-post-build-action)
      - [PUBLISHING TO ARTIFACTORY](#publishing-to-artifactory)
      - [PUBLISHING VIA MAVEN](#publishing-via-maven)
      - [PUSHING A DOCKER CONTAINER](#pushing-a-docker-container)
  - [Automated deployments](#automated-deployments)
    - [Retrieving build artifacts and packages](#retrieving-build-artifacts-and-packages)
      - [FETCHING ARTIFACTS VIA ARCHIVE ARTIFACTS](#fetching-artifacts-via-archive-artifacts)
      - [FETCHING ARTIFACTS FROM ARTIFACTORY](#fetching-artifacts-from-artifactory)
      - [FETCHING ARTIFACTS VIA MAVEN](#fetching-artifacts-via-maven)
    - [Leveraging Jenkins slave nodes for deployment](#leveraging-jenkins-slave-nodes-for-deployment)
- [Continuous Practices](#continuous-practices)
  - [Continuous Integration](#continuous-integration)
    - [What Continuous Integration is not](#what-continuous-integration-is-not)
    - [Code-based branching techniques](#code-based-branching-techniques)
      - [Feature toggles](#feature-toggles)
    - [Continuous Integration in Jenkins](#continuous-integration-in-jenkins)
      - [SCM POLLING](#scm-polling)
      - [RUNNING A JENKINS JOB VIA THE SVN POST-COMMIT HOOKS](#running-a-jenkins-job-via-the-svn-post-commit-hooks)
      - [TRIGGERING A JENKINS JOB VIA GITHUB PUSH](#triggering-a-jenkins-job-via-github-push)
  - [Continuous Delivery](#continuous-delivery)
  - [Continuous Deployment](#continuous-deployment)
    - [Continuous Deployment in Jenkins](#continuous-deployment-in-jenkins)
- [Integrating Jenkins with Other Technologies](#integrating-jenkins-with-other-technologies)
  - [Jenkins and Docker – Linux guide](#jenkins-and-docker-%e2%80%93-linux-guide)
  - [Integrating Jenkins with Ansible – Linux and Windows](#integrating-jenkins-with-ansible-%e2%80%93-linux-and-windows)
  - [Jenkins and Artifactory](#jenkins-and-artifactory)
  - [Jenkins and Selenium Grid](#jenkins-and-selenium-grid)
  - [Jenkins and Jira](#jenkins-and-jira)

# Distributed Builds – Master Slave Mode
## Understanding the master and slave architecture
A Jenkins slave node is simply a device configured to act as an automation executor on behalf of the master. The Jenkins master simply represents the base installation of Jenkins. The master will continue to perform basic operations and serve the user interface, while the slaves do the heavy lifting.

![2-1](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_01.jpg)

Figure 2-1: A Jenkins master connected to three slave node devices

Some responsibilities that are specific to the Jenkins master and cannot not be delegated to the slave nodes include:

- SCM polling (SVN, GIT, Perforce, and so on)
- Job scheduling
- LDAP authentication
- Build output, reporting, and notifications
- Job history and build logs
- Executing jobs/tasks tied to the master

![2-2](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_02.jpg)

Figure 2-2: Expanded Jenkins master and slave connectivity diagram

## Choosing a launch method
The Jenkins new slave node configuration screen provided us with the following available launch methods.

- Launch slave agents via Java Web Start (preferred)
- Launch slave agents on Unix machines via SSH
- Let Jenkins control this Windows slave as a Windows service (using DCOM and WMI is sometimes error prone)
- Launch slave via execution of command on the Master

### Slave agents via SSH tunneling
The SSH launch method provides a number of valuable features that make this an attractive option when connecting Jenkins slave agents to the master. These benefits include:

- More reliable connectivity and stability
- Encrypted communications
- Auto restart and reconnect functionality
- No need for slave services or init.d scripts

![2-13](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_12.jpg)

Figure 2-13: SSH Host and Credentials Section

## Administering Jenkins slaves
### The node administration dashboard
![2-14](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_13.jpg)

Figure 2-14: Node administration dashboard

![2-15](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_14.jpg)

Figure 2-15: Offline slave node marked with an X

### Preventative monitoring
![2-16](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_15.jpg)

Figure 2-16: Preventative node monitoring configuration page

### Managing individual slave nodes
![2-17](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_16.jpg)

Figure 2-17: Slave node status and configuration

Let's define each of these options and learn what they do:

- Back to List: Navigates back to the node administration dashboard.
- Status: Navigates us back to the status page for the current selected slave node.
- Delete Slave: Removes the slave from the Jenkins master and severs any ties between the slave and the master.
- Configure: Navigates us to the detailed node configuration page.
- Build History: Displays a set of historical timelines of jobs that have run on this slave node.
- Load Statistics: Shows key metrics and resource utilization in graph form. It has three timespan view options: Short, Medium, and Long. These options allow us to adjust the timespan of the graph accordingly.
- Script Console: Jenkins features a robust built-in scripting system called Groovy. With this console, you can run arbitrary one-off scripts directly on the slave node. You will learn more about writing Groovy scripts for Jenkins later.
- Log: Displays in real time the connection status between the Jenkins master and the slave node. These logs can be very valuable when troubleshooting connectivity issues.

## Labels, groups, and load balancing
![2-18](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_17.jpg)

Figure 2-18: A basic Windows build pool

### Attaching a slave to a group by creating a label
By labeling multiple slave nodes with the same label, we can create groups. Groups of devices can prove to be handy when offloading automation. Creating a group of slave nodes simply means that they share a common label.

![2-19](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_18.jpg)

Figure 2-19: Adding a Windows label to a slave node

![2-20](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_19.jpg)

Figure 2-20: A A slave node in one group (based on a label)

### Attaching a slave to many groups
Through Jenkins label and grouping system, Jenkins provides a mechanism by which jobs can run on one or many slave nodes (load balancing).

![2-21](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_20.jpg)

Figure 2-21: Attaching a slave node to multiple groups

![2-22](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_21.jpg)

Figure 2-22: A slave node belonging to two groups

### Restricting slave execution to global or tied jobs
![2-23](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_02_22.jpg)

Figure 2-23: Usage dropdown in the detailed configuration form

### Jenkins plugins that support distributed builds
At the time of writing this book, some of the more notable master/slave distributed build extension plugins for Jenkins include:

- Amazon EC2 plugin
- Microsoft Azure
- Swarm
- Docker plugin
- Hadoop plugin
- CloudBees Cloud Connector plugin
- Selenium plugin
- vSphere Cloud plugin

# Creating Views and Jobs in Jenkins
## Jobs in Jenkins
![3-7](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_03_07.jpg)

Figure 3-7: New item basic configuration page

Let's discuss each of the available job types and learn about the individual options prescribed for each job:

- Freestyle project: This provides the ability to create a completely custom job that can behave in any way we choose.
- Maven project: This is designed specifically for JAVA Maven projects. It utilizes Production and Operations Management Society (POMS) and provides an easy to use interface for execution of Maven targets.
- Multiconfiguration project: This is designed for projects that have multiple configurations (x86, x64, and so on). It allows you to specify a single job with multiple output types.
- Copy existing job: This allows the user to duplicate the contents of an existing job and alter the name.
- External job: This allows the user to trigger and monitor an external Jenkins job. This external job type is particularly handy when there are multiple Jenkins instances (for example, a development Jenkins instance and a production Jenkins instance) that are responsible for production deployments.

# Advanced Automated Testing
## Quality assurance initiatives and test automation terminology
Let's take a minute to define some quality assurance, and automated testing terminology:

`Unit tests`: Unit tests can be described as tests that run directly on the build machine during the build process and are designed to validate the I/O of classes, methods, objects, and functions.

![5-1](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_01.jpg)

Figure 5-1: A unit test structure

`Smoke / BVT (Build Verification tests)`: Smoke tests (more commonly known as build verification tests) validate basic operational functionality of a software project. Generally these tests attempt to identify simplistic operational failures that are catastrophic, and prevent the software from being considered viable for further testing.

![5-2](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_02.jpg)

Figure 5-2: A basic smoke test workflow

`Functional tests`: Functional (or acceptance) tests validate the operability of a software project, and ensure the implementation of the software project is in line with functional requirement specifications, and business initiatives.

`Regression tests`: Regression tests aim to reproduce defects identified by users in the field. The ultimate goal of a regression test is to automate the reproduction of a defect, and ensure that the defect does not re appear. Advanced regression testing solutions should aim to provide a system that can visually reproduce a defect for developers based on the entry of a bug tracking ticket identification number. In such a system a developer would simply enter the bug ID into the automated test case execution system, which would then illustrate the steps needed to reproduce a bug on a given environment.

`Capacity tests`: Capacity tests are tests designed to simulate stress and load on an application suite. These tests help ensure that the software can withstand real-world use and abuse. Testing application load and stress capabilities can be accomplished via the implementation of valid use case scenarios, which are then replicated and distributed across multiple simulators.

`Black Box tests`: Black Box tests execute from that same perspective as the end consumer of the software. They have no visibility into the internals of a software project or the system it runs on and can only see the software from the consumer's perspective.

![5-3](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_03.jpg)

Figure 5-3: A simple black box test

`White Box tests`: White box tests are tests that have the ability to see into the internals of a software application and can validate file structures, application process ID's, and other internally available information related to the software. White box tests may also have the ability to see into the system that the software is running on and can verify lower-level operational capabilities of the software itself.

![5-4](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_04.jpg)

Figure 5-4: White Box testing

`A/B testing`: Understanding customer usage and acceptance of new features within a software project has been a business hurdle for many years. A/B testing allows business interests to propose new features to end-users, collect usage data metrics through analytics, and provide feedback related to the adoption of a proposed feature. These experiment-driven testing solutions allow the business to decide through data metrics when a feature creates customer value, and when it does not, thus allowing the business to focus on features that drive revenue. More advanced implementations of A/B testing solutions allow the business to incrementally expose users to a feature hypothesis and collect real-time feedback on its adoption.

## The Software Development Lifecycle
![5-5](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_05.jpg)

Figure 5-5: The Software Development Lifecycle

![5-6](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_06.jpg)

Figure 5-6: Continuous Software Development Lifecycle

## Connecting product codes to tests
![5-7](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_08.jpg)

Figure 5-7: The Test Driven Development paradigm

## Baking quality into the product
![5-8](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_09.jpg)

Figure 5-8: Test coverage pyramid

### Smoke test tip
It is highly recommend that a simplistic smoke test suite be created and executed immediately after the deployment to an environment. The smoke tests will validate the viability of the environment and determine if it is worth testing further.

## Distributed testing solutions
![5-20](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_Ch5_21.jpg)

Figure 5-20: Distributed slave test architectures

# Software Deployments and Delivery
## Standardizing build outputs
Let's look at the basic flow of a generic build process:

1. Obtain a clean copy of the source code from source control.
2. Fetch any dependencies (preferably from an artifact repository).
3. Version stamp any necessary code (may be a pre-compile or post-compile step, depending on the technology stack).
4. Compile the source code and verify syntax.
5. Execute unit tests (unit-based validation of objects, methods, and classes).
6. Collate compiled objects, binaries, or deliverables into a common output directory.
7. Create a package containing the binaries and deliverables.
8. Publish a versioned deliverable to an artifact repository.

### Architecting a packaging scheme
The following diagram shows a simple source control timeline. It describes the lockstep evolution of product code, automation, and tests with regard to packaging:

![6-1](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_01.jpg)

Figure 6-1: Suggested packaging scheme

### Build and deployment best practice
The goal of any build system should be to create a package that can be deployed repeatedly. The common phrase is `build once, deploy many`.

### Snapshots and Releases Tip
When implementing a package system, you may consider creating two or more identical packages: one for snapshots, which represents the latest build, and an additional item , which might represent the latest released version. This can be helpful when performing automated deployments and managing dependencies, as the packages could then be retrieved easily, without the need to specify a version number, and could be fetched via a simple static URL.

## Implementing a Definitive Media Library
A `Definitive Media Library (DML)` a term coined by ITIL and often referred to as a DML is recognized as a single source of truth for company software assets, dependencies, and third-party libraries. By nature a DML ensures assets are backed up, checksum verified, and managed appropriately.

### Publishing assets to a DML
#### JENKINS' ARCHIVE THE ARTIFACTS POST-BUILD ACTION
![6-3](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_03.jpg)

Figure 6-3: Archive the artifacts

#### PUBLISHING TO ARTIFACTORY
![6-5](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_05.jpg)

Figure 6-5: Artifactory architecture

![6-6](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_06.jpg)

Figure 6-6: Publishing artifacts to Artifactory

#### PUBLISHING VIA MAVEN
Artifacts can be published to multiple DML solutions, including Sonatype Nexus, Apache Archiva, Exeters Origin, and others via a simple deploy target, which is embedded directly within the Maven architecture.

#### PUSHING A DOCKER CONTAINER
![6-7](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_07.jpg)

Figure 6-7: Execute Docker container build step

## Automated deployments
Below is a list of basic deployment steps, which can serve as a template for creating deployment automation.

- A Jenkins deployment job will be triggered, which will be responsible for the deployment.
- Jenkins will need to either push the package to a targeted environment or perform the following steps on the target environment itself (via slave nodes). The deployment job will need to perform the execution of the following actions:
  - Identify the version of the software to be deployed
  - Download the versioned package from the DML
  - Verify the CRC fingerprints of the deployable entity
  - Extract the contents of the package into a temporary folder on the deployment environment.
- Execute the deployment automation in the package to install the software.
- Verify that the deployment was successful through basic sanity tests
- Jenkins will need to determine whether the deployment was a success or a failure due to recognized return codes.

### Retrieving build artifacts and packages
#### FETCHING ARTIFACTS VIA ARCHIVE ARTIFACTS
![6-9](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_09.jpg)

Figure 6-9: Copy artifacts build step

#### FETCHING ARTIFACTS FROM ARTIFACTORY
![6-10](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_06_10.jpg)

Figure 6-10: Automation of Artifact repository

#### FETCHING ARTIFACTS VIA MAVEN
Artifact repositories also provide a scalable solution to resolve Maven dependencies. Resolving dependencies in Maven can be done via a simple update of the POM file.

### Leveraging Jenkins slave nodes for deployment
You can follow these basic steps when deploying an application onto a slave node:

1. Download the deployment package from the DML (you could use copy the artifacts here if you use Jenkins as your DML).
2. Verify that the CRC checksums for the package are downloaded.
3. Extract the deployment package (unzip, tar, and so on).
4. Execute the deployment scripts embedded in the package.
5. Run application startup sequences.

# Continuous Practices
## Continuous Integration
`Continuous Integration (CI)` is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

### What Continuous Integration is not
>"Continuous Integration is NOT running Jenkins on your feature branches. Continuous Integration is a practice where every developer integrates their changes to the mainline at least once a day" --Jez Humble

![8-4](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_04.jpg)

Figure 8-4: Continuous Integration

To practice Continuous Integration, the software development group must, at a minimum, do the following:

- Implement a trunk-based development model (or a highly disciplined, short-lived feature branch solution), where each developer commits (or merges) code into the mainline at least once per day
- Automate the detection of commits, and initiate a build for every commit detected
- Automate the execution and reporting of unit tests, which must run as part of the build process and aim to validate the code IO operability
- Create a rapid feedback loop system to notify and flag any potential defects detected by the build process
- Place urgency on addressing or reverting any violating code commits that break the build

### Code-based branching techniques
`Branching by abstraction` and `feature toggles` are two additional software architectural techniques that can be employed to alleviate the need for source control based feature branches.

Branching by abstraction is an architectural technique designed to facilitate refactoring efforts and allow replacement parts to co-exist with living implementations without risk.

![8-5](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_05.jpg)

Figure 8-5: Branching Abstraction architecture

#### Feature toggles
Feature toggles represent a source code branching technique which, enable or disable functionality based on a condition.

Consider the following code example:

```js
if (bToggle == true) {
   …
} else {
   …
}
```

A more modern example of a feature toggle solution for an HTML/Javascript web project might look like the following:

```js
<script type="text/javascript">
<!--
    function toggle_feature(id)
    {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>

<a href="#" onclick="toggle_feature('PrototypeFeature');">Click here to view the prototype effort</a>

<div id="PrototypeFeature">This feature is hidden from view until its toggled on</div>
```

- Feature toggles in Java:
  - Togglz: http://www.togglz.org
  - FF4J: http://www.ff4j.org
  - Fitchy: https://code.google.com/p/fitchy/
- Feature toggles in Python:
  - Gargoyle: https://pypi.python.org/pypi/gargoyle
  - Gutter: https://github.com/disqus/gutter
- Feature Toggles in Embedded/C/C++ (Constructs) (coding techniques):
  - Ifdef
  - Make targets

### Continuous Integration in Jenkins
#### SCM POLLING
Polling a source control solution for changes can be configured in the job configuration page.

#### RUNNING A JENKINS JOB VIA THE SVN POST-COMMIT HOOKS
In addition to SCM polling, a Jenkins job can be triggered through an SVN post-commit hook (push).

#### TRIGGERING A JENKINS JOB VIA GITHUB PUSH
![8-9](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_09.jpg)

Figure 8-9: GitHub plugin configuration

## Continuous Delivery
`Continuous Delivery (CD)` represents the expansion of Continuous Integration practices.Continuous Delivery adds automated deployments and acceptance test verification automation to the solution and ensures the software project is in an always-releasable state.

![8-10](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_10.jpg)

Figure 8-10: Continuous Delivery workflow

When implementing a continuous delivery solution, there are a few key points that we should keep in mind:

- Keep the build fast
- Illuminate the failures, and recover immediately
- Make deployments push-button, for any version to any environment
- Automate testing and validation operations with defined buckets for each logical test group (unit, smoke, functional, and regression)
- Use feature toggles to avoid branching
- Get feedback early and often (automation feedback, test feedback, build feedback, and UAT feedback)

## Continuous Deployment
![8-20](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_20.jpg)

Figure 8-20: Differentiation between Continuous Delivery and Continuous Deployment

If the business unit indeed desires to migrate towards a Continuous Deployment solution, tight controls on quality will be required to facilitate stability and avoid outages. These controls may include any of the following:

- The required unit testing with code coverage metrics
- The required a/b testing or experiment-driven development
- Paired programming
- Automated rollbacks
- Code reviews and static code analysis implementations
- Behavior-driven development (BDD)
- Test-driven development (TDD)
- Automated smoke tests in production

### Continuous Deployment in Jenkins
![8-21](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_08_21.jpg)

Once the promotions become automatic, the build automation solutions will continuously deploy for every commit to the mainline (given that all the automated tests have been passed).

# Integrating Jenkins with Other Technologies
## Jenkins and Docker – Linux guide
- Running Jenkins inside a Docker container – Linux
- Dynamic Jenkins slave nodes using Docker

## Integrating Jenkins with Ansible – Linux and Windows
![9-6](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_09_06.jpg)

Figure 9-6: The Ansible Pull architecture

![9-7](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_09_07.jpg)

Figure 9-7: The Ansible Push architecture

## Jenkins and Artifactory
Jfrog's Artifactory (and Sonatype Nexus) have been pivotal advocates for Continuous Delivery implementations for some time now. Artifactory provides a set of centrally configurable repositories, which can be leveraged to facilitate uploading, storing, downloading, and fetching build packages, Docker containers (Docker registries through Artifactory requires the Pro version), and binary assets.

![9-12](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_09_12.jpg)

Figure 9-12: The basic Artifactory architecture

## Jenkins and Selenium Grid
A Selenium Grid provides a distributed automated testing solution that executes test cases in parallel.

![9-15](https://www.safaribooksonline.com/library/view/mastering-jenkins/9781784390891/graphics/B03470_09_15.jpg)

Figure 9-15: Selenium distributed architecture

## Jenkins and Jira
Jenkins and Jira
Atlassian's Jira (http://www.atlassian.com) has quickly become an industry-wide powerhouse for tracking Agile efforts, managing development implementation queues, and providing project management solutions for software teams.


text:
package nablarch.core.dataformat.convertor.logicbased;

import nablarch.core.dataformat.convertor.datatype.DataType;

public class CustomType extends DataType<String, String> {

    @Override
    public DataType<String, String> initialize(final Object... args) {
        return null;
    }

    @Override
    public String convertOnRead(final String data) {
        return null;
    }

    @Override
    public String convertOnWrite(final Object data) {
        return null;
    }

    @Override
    public Integer getSize() {
        return null;
    }
}


text:
package org.visallo.core.status;

public interface PausableTimerContextAware {
    void setPausableTimerContext(PausableTimerContext pausableTimerContext);
}


text:
"""
WSGI config for pfss project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pfss.settings")

application = get_wsgi_application()


text:
/* eslint-env jasmine */
import { parser } from './parser/stateDiagram';
import stateDb from './stateDb';

describe('state diagram, ', function() {
  describe('when parsing an info graph it', function() {
    beforeEach(function() {
      parser.yy = stateDb;
    });

    it('super simple', function() {
      const str = `
      stateDiagram
        [*] --> State1
        State1 --> [*]
      `;

      parser.parse(str);
    });
    it('simple', function() {
      const str = `stateDiagram\n
          State1 : this is another string
          [*] --> State1
          State1 --> [*]
      `;

      parser.parse(str);
    });
    it('simple with directive', function() {
      const str = `%%{init: {'logLevel': 0 }}%%
      stateDiagram\n
          State1 : this is another string
          [*] --> State1
          State1 --> [*]
      `;

      parser.parse(str);
    });
    it('should handle relation definitions', function() {
      const str = `stateDiagram\n
        [*] --> State1
        State1 --> [*]
        State1 : this is a string
        State1 : this is another string

        State1 --> State2
        State2 --> [*]
      `;

      parser.parse(str);
    });
    it('hide empty description', function() {
      const str = `stateDiagram\n
        hide empty description
        [*] --> State1
        State1 --> [*]
        State1 : this is a string
        State1 : this is another string

        State1 --> State2
        State2 --> [*]
      `;

      parser.parse(str);
    });

    it('handle "as" in state names', function() {
      const str = `stateDiagram
      assemble
      state assemble
      `;

      parser.parse(str);
    });
    it('handle "as" in state names 1', function() {
      const str = `stateDiagram
      assemble
      state assemble
      `;

      parser.parse(str);
    });
    it('handle "as" in state names 2', function() {
      const str = `stateDiagram
      assembleas
      state assembleas
      `;

      parser.parse(str);
    });
    it('handle "as" in state names 3', function() {
      const str = `stateDiagram
      state "as" as as
      `;

      parser.parse(str);
    });

    it('scale', function() {
      const str = `stateDiagram\n
        scale 350 width
        [*] --> State1
        State1 --> [*]
        State1 : this is a string with - in it
        State1 : this is another string

        State1 --> State2
        State2 --> [*]
      `;

      parser.parse(str);
    });

    it('description after second state', function() {
      const str = `stateDiagram\n
        scale 350 width
        [*] --> State1 : This is the description with - in it
        State1 --> [*]
      `;

      parser.parse(str);
    });
    it('shall handle descriptions inkluding minus signs', function() {
      const str = `stateDiagram\n
        scale 350 width
        [*] --> State1 : This is the description +-!
        State1 --> [*]
      `;

      parser.parse(str);
    });
    it('should handle state statements', function() {
      const str = `stateDiagram\n
        state Configuring {
          [*] --> NewValueSelection
          NewValueSelection --> NewValuePreview : EvNewValue
          NewValuePreview --> NewValueSelection : EvNewValueRejected
          NewValuePreview --> NewValueSelection : EvNewValueSaved1
        }
      `;

      parser.parse(str);
    });
    it('should handle recursive state definitions', function() {
      const str = `stateDiagram\n
        state Configuring {
          [*] --> NewValueSelection
          NewValueSelection --> NewValuePreview : EvNewValue
          NewValuePreview --> NewValueSelection : EvNewValueRejected
          NewValuePreview --> NewValueSelection : EvNewValueSaved

          state NewValuePreview {
          State1 --> State2
          }
        }
      `;

      parser.parse(str);
    });
    it('should handle multiple recursive state definitions', function() {
      const str = `stateDiagram\n
        scale 350 width
        [*] --> NotShooting

        state NotShooting {
          [*] --> Idle
          Idle --> Configuring : EvConfig
          Configuring --> Idle : EvConfig
        }

        state Configuring {
          [*] --> NewValueSelection
          NewValueSelection --> NewValuePreview : EvNewValue
          NewValuePreview --> NewValueSelection : EvNewValueRejected
          NewValuePreview --> NewValueSelection : EvNewValueSaved

          state NewValuePreview {
          State1 --> State2
          }
        }
      `;

      parser.parse(str);
    });
    it('should handle state deifintions with separation of id', function() {
      const str = `stateDiagram\n
        state "Long state description" as state1
        `;

      parser.parse(str);
    });
    it('should handle state deifintions with separation of id', function() {
      const str = `stateDiagram
      state "Not Shooting State" as NotShooting {
        state "Idle mode" as Idle
        state "Configuring mode" as Configuring
        [*] --> Idle
        Idle --> Configuring : EvConfig
        Configuring --> Idle : EvConfig
      }
        `;

      parser.parse(str);
    });

    it('should State definition with quotes', function() {
      const str = `stateDiagram\n
        scale 600 width

        [*] --> State1
        State1 --> State2 : Succeeded
        State1 --> [*] : Aborted
        State2 --> State3 : Succeeded
        State2 --> [*] : Aborted
        state State3 {
          state "Accumulate Enough Data\nLong State Name" as long1
          long1 : Just a test
          [*] --> long1
          long1 --> long1 : New Data
          long1 --> ProcessData : Enough Data
        }
        State3 --> State3 : Failed
        State3 --> [*] : Succeeded / Save Result
        State3 --> [*] : Aborted
      `;

      parser.parse(str);
    });
    it('should handle fork statements', function() {
      const str = `stateDiagram\n
        state fork_state <<fork>>
        [*] --> fork_state
        fork_state --> State2
        fork_state --> State3

        state join_state <<join>>
        State2 --> join_state
        State3 --> join_state
        join_state --> State4
        State4 --> [*]
      `;

      parser.parse(str);
    });
    it('should handle concurrent state', function() {
      const str = `stateDiagram\n
        [*] --> Active

        state Active {
          [*] --> NumLockOff
          NumLockOff --> NumLockOn : EvNumLockPressed
          NumLockOn --> NumLockOff : EvNumLockPressed
          --
          [*] --> CapsLockOff
          CapsLockOff --> CapsLockOn : EvCapsLockPressed
          CapsLockOn --> CapsLockOff : EvCapsLockPressed
          --
          [*] --> ScrollLockOff
          ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
          ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
        }
      `;

      parser.parse(str);
    });
    it('should handle concurrent state', function() {
      const str = `stateDiagram\n
        [*] --> Active

        state Active {
          [*] --> NumLockOff
          --
          [*] --> CapsLockOff
          --
          [*] --> ScrollLockOff
        }
      `;

      parser.parse(str);
    });
    // it('should handle arrow directions definitions', function() {
    //   const str = `stateDiagram\n
    //     [*] -up-> First
    //     First -right-> Second
    //     Second --> Third
    //     Third -left-> Last
    //   `;

    //   parser.parse(str);
    // });
    it('should handle note statements', function() {
      const str = `stateDiagram\n
        [*] --> Active
        Active --> Inactive

        note left of Active : this is a short
note

        note right of Inactive
          A note can also
          be defined on
          several lines
        end note
      `;

      parser.parse(str);
    });
    it('should handle multiline notes with different line breaks', function() {
      const str = `stateDiagram
        State1
        note right of State1
          Line1
Line2
Line3
Line4
Line5
        end note
      `;

      parser.parse(str);
    });
    it('should handle floating notes', function() {
      const str = `stateDiagram
        foo: bar
        note "This is a floating note" as N1
      `;

      parser.parse(str);
    });
    it('should handle floating notes', function() {
      const str = `stateDiagram\n
        state foo
        note "This is a floating note" as N1
      `;

      parser.parse(str);
    });
    it('should handle notes for composit states', function() {
      const str = `stateDiagram\n
        [*] --> NotShooting

        state "Not Shooting State" as NotShooting {
          state "Idle mode" as Idle
          state "Configuring mode" as Configuring
          [*] --> Idle
          Idle --> Configuring : EvConfig
          Configuring --> Idle : EvConfig
        }

        note right of NotShooting : This is a note on a composite state
      `;

      parser.parse(str);
    });
  });
  describe('when parsing an ignored info graph it', function() {

    xit('should handle if statements', function() {
      const str = `stateDiagram\n
      [*] --> "Order Submitted"
      if "Payment Accepted" then
        -->[yes] "Pack products"
        --> "Send parcel"
        -right-> (*)
      else
        ->[no] "Send error message"
        -->[Cancel Order] [*]
      endif
        }

        note right of NotShooting : This is a note on a composite state
      `;

      parser.parse(str);
    });
  });
});


text:
'use strict';

var assign = require('lodash.assign');

var htmlInject = require('./html-inject');

/**
 * Create a content template function for use with html-webpack-plugin.
 * @param {string} htmlEntry The name of the entry that should contain only the index.html
 * @param {boolean} [useHash] Optionally hash the output filename
 * @returns {function} content template function for use with html-webpack-plugin
 */
function templateContent(htmlEntry, useHash) {
  return function templateProper(context) {

    // hash the filename after we know what the value is
    if (useHash) {
      context.compilation.plugin('html-webpack-plugin-after-html-processing', afterProcessing);
    }

    // get the final content of the html entry and the chunk manifest (where present)
    var assets       = context.compilation.assets,
        initialValue = {manifest: null};
    initialValue[htmlEntry] = null;

    var content = Object.keys(assets)
      .reduce(reduceAssets, initialValue);

    // inline the chunk manifest (where present)
    var files = assign({
      inline: content.manifest ? ['window.webpackManifest=' + content.manifest.toString() + ';'] : []
    }, context.htmlWebpackPlugin.files);

    // try to inject otherwise let the plugin do it
    var html = htmlInject(content.indexhtml, files);
    context.htmlWebpackPlugin.options.inject = !html;
    return html || content.indexhtml;

    function reduceAssets(reduced, key) {
      Object.keys(reduced).reduce(reduceCandidate, reduced);
      return reduced;

      function reduceCandidate(reduced, candidate) {
        if (key.indexOf(candidate + '.') === 0) {
          if (/\.(html|json)$/.test(key)) {
            reduced[candidate] = assets[key]._value || assets[key].children[0]._value;
          }
          delete assets[key];
        }
        return reduced;
      }
    }

    function afterProcessing(context, done) {
      var plugin  = context.plugin,
          options = plugin.options;
      options.filename = options.filename
        .replace('.', '.' + plugin.childCompilerHash.slice(0, 20) + '.');
      done();
    }
  };
}

module.exports = templateContent;


text:
'use strict';

/**
 * @ngdoc directive
 * @name arethusa.core.directives:keyCapture
 * @restrict A
 *
 * @description
 * Captures keydown and keyup events on the element and
 * delegates the event handling to the keyCapture service.
 *
 * @requires arethusa.core.keyCapture
 */
angular.module('arethusa.core').directive('keyCapture', [
  'keyCapture',
  function (keyCapture) {
    return {
      restrict: 'A',
      link: function (scope, element, attrs) {
        element.on('keydown', function (event) {
          keyCapture.keydown(event);
        });
        element.on('keyup', function (event) {
          keyCapture.keyup(event);
        });
      }
    };
  }
]);


text:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class PagesController extends Controller
{
    public function home()
    {
    	return view('pages.home');
    }
}