text:
package rotateList;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Given a list, rotate the list to the right by k places, where k is non-negative.
 * <p/>
 * For example:
 * Given 1->2->3->4->5->NULL and k = 2,
 * return 4->5->1->2->3->NULL.
 */
public class Solution {
    public ListNode rotateRight(ListNode head, int n) {
        if (head == null) {
            return null;
        }

        int size = 1;
        ListNode last = head;
        while (last.next != null) {
            size++;
            last = last.next;
        }
        last.next = head;

        int pos = (size - n % size) % size;
        while (pos-- > 0) {
            last = last.next;
        }

        ListNode newHead = last.next;
        last.next = null;
        return newHead;
    }

    @Test
    public void test1() {
        ListNode head = new ListNode(1);
        head.next = new ListNode(2);
        head.next.next = new ListNode(3);
        ListNode root = rotateRight(head, 2);
        assertEquals(2, root.val);
        assertEquals(3, root.next.val);
        assertEquals(1, root.next.next.val);
        assertEquals(null, root.next.next.next);
    }
}


text:
package couchdb2go

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"time"
)

type Client interface {
	Meta() (*MetaResponse, error)
	ActiveTasks() (*ActiveTasksResponse, error)
	AllDbs() (*AllDbsResponse, error)
	DbUpdates(r *DbUpdatesRequest) (*DbUpdatesResponse, error)
	Membership() (*MembershipResponse, error)
	Log(*LogRequest) (*LogResponse, error)
	Replicate() (*ReplicateResponse, error)
	Restart() (*RestartResponse, error)
	Stats() (*StatsResponse, error)
	UUIDs(uint8) (*UUIDsResponse, error)
	Config() (*ConfigResponse, error)
	Config
}

type Config interface {
	Section(string) (*ConfigSectionResponse, error)
	// TODO Config interface
	//Key(s, k string)
	//SetKey(s, k string)
	//DeleteKey(s, k string)
}

type MetaResponse struct {
	ErrorResponse
	CouchDB string `json:"couchdb"`
	UUID    string `json:"uuid"`
	Vendor  struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"vendor"`
	Version string `json:"version"`
}

type ActiveTasksResponse []struct {
	ErrorResponse
	ChangesDone           int         `json:"changes_done,omitempty"`
	Database              string      `json:"database,omitempty"`
	Pid                   string      `json:"pid"`
	Progress              int         `json:"progress"`
	StartedOn             int         `json:"started_on"`
	TotalChanges          int         `json:"total_changes,omitempty"`
	Type                  string      `json:"type"`
	UpdatedOn             int         `json:"updated_on"`
	DesignDocument        string      `json:"design_document,omitempty"`
	CheckpointedSourceSeq int         `json:"checkpointed_source_seq,omitempty"`
	Continuous            bool        `json:"continuous,omitempty"`
	DocID                 interface{} `json:"doc_id,omitempty"`
	DocWriteFailures      int         `json:"doc_write_failures,omitempty"`
	DocsRead              int         `json:"docs_read,omitempty"`
	DocsWritten           int         `json:"docs_written,omitempty"`
	MissingRevisionsFound int         `json:"missing_revisions_found,omitempty"`
	ReplicationID         string      `json:"replication_id,omitempty"`
	RevisionsChecked      int         `json:"revisions_checked,omitempty"`
	Source                string      `json:"source,omitempty"`
	SourceSeq             int         `json:"source_seq,omitempty"`
	Target                string      `json:"target,omitempty"`
}

type AllDbsResponse []string

type DbUpdatesRequest struct {
	Feed      string `json:"feed"`
	Timeout   int    `json:"timeout"`
	HeartBeat bool   `json:"heartbeat"`
}

type DbUpdatesResponse struct {
	ErrorResponse
	DbName string `json:"db_name"`
	Ok     bool   `json:"ok"`
	Type   string `json:"type"`
}

type MembershipResponse struct {
	ErrorResponse
	AllNodes     []string `json:"all_nodes"`
	ClusterNodes []string `json:"cluster_nodes"`
}

type LogRequest struct {
	ErrorResponse
	Bytes  uint32 `json:"bytes"`
	Offset uint32 `json:"offset"`
}
type LogResponse string

type ReplicateRequest struct {
	Cancel       bool     `json:"cancel"`
	Continuous   bool     `json:"continuous"`
	CreateTarget bool     `json:"create_target"`
	DocIds       []string `json:"doc_ids"`
	Proxy        string   `json:"proxy"`
	Source       string   `json:"source"`
	Target       string   `json:"target"`
}

type ReplicateResponse struct {
	ErrorResponse
	History []struct {
		DocWriteFailures int    `json:"doc_write_failures"`
		DocsRead         int    `json:"docs_read"`
		DocsWritten      int    `json:"docs_written"`
		EndLastSeq       int    `json:"end_last_seq"`
		EndTime          string `json:"end_time"`
		MissingChecked   int    `json:"missing_checked"`
		MissingFound     int    `json:"missing_found"`
		RecordedSeq      int    `json:"recorded_seq"`
		SessionID        string `json:"session_id"`
		StartLastSeq     int    `json:"start_last_seq"`
		StartTime        string `json:"start_time"`
	} `json:"history"`
	Ok                   bool   `json:"ok"`
	ReplicationIDVersion int    `json:"replication_id_version"`
	SessionID            string `json:"session_id"`
	SourceLastSeq        int    `json:"source_last_seq"`
}

type RestartResponse struct {
	ErrorResponse
	Ok bool `json:"ok"`
}

type StatsResponse struct {
	ErrorResponse
	Couchdb struct {
		RequestTime struct {
			Current     float64 `json:"current"`
			Description string  `json:"description"`
			Max         float64 `json:"max"`
			Mean        float64 `json:"mean"`
			Min         float64 `json:"min"`
			Stddev      float64 `json:"stddev"`
			Sum         float64 `json:"sum"`
		} `json:"request_time"`
	} `json:"couchdb"`
}

type UUIDsResponse struct {
	ErrorResponse
	Uuids []string `json:"uuids"`
}

type ConfigResponse struct {
	ErrorResponse
	Attachments struct {
		CompressibleTypes string `json:"compressible_types"`
		CompressionLevel  string `json:"compression_level"`
	} `json:"attachments"`
	CouchHttpdAuth struct {
		AuthCacheSize          string `json:"auth_cache_size"`
		AuthenticationDb       string `json:"authentication_db"`
		AuthenticationRedirect string `json:"authentication_redirect"`
		RequireValidUser       string `json:"require_valid_user"`
		Timeout                string `json:"timeout"`
	} `json:"couch_httpd_auth"`
	Couchdb struct {
		DatabaseDir            string `json:"database_dir"`
		DelayedCommits         string `json:"delayed_commits"`
		MaxAttachmentChunkSize string `json:"max_attachment_chunk_size"`
		MaxDbsOpen             string `json:"max_dbs_open"`
		MaxDocumentSize        string `json:"max_document_size"`
		OsProcessTimeout       string `json:"os_process_timeout"`
		URIFile                string `json:"uri_file"`
		UtilDriverDir          string `json:"util_driver_dir"`
		ViewIndexDir           string `json:"view_index_dir"`
	} `json:"couchdb"`
	Daemons struct {
		AuthCache        string `json:"auth_cache"`
		DbUpdateNotifier string `json:"db_update_notifier"`
		ExternalManager  string `json:"external_manager"`
		Httpd            string `json:"httpd"`
		QueryServers     string `json:"query_servers"`
		StatsAggregator  string `json:"stats_aggregator"`
		StatsCollector   string `json:"stats_collector"`
		Uuids            string `json:"uuids"`
		ViewManager      string `json:"view_manager"`
	} `json:"daemons"`
	Httpd struct {
		AllowJsonp             string `json:"allow_jsonp"`
		AuthenticationHandlers string `json:"authentication_handlers"`
		BindAddress            string `json:"bind_address"`
		DefaultHandler         string `json:"default_handler"`
		MaxConnections         string `json:"max_connections"`
		Port                   string `json:"port"`
		SecureRewrites         string `json:"secure_rewrites"`
		VhostGlobalHandlers    string `json:"vhost_global_handlers"`
	} `json:"httpd"`
	HttpdDbHandlers struct {
		Changes     string `json:"_changes"`
		Compact     string `json:"_compact"`
		Design      string `json:"_design"`
		TempView    string `json:"_temp_view"`
		ViewCleanup string `json:"_view_cleanup"`
	} `json:"httpd_db_handlers"`
	HttpdDesignHandlers struct {
		Info    string `json:"_info"`
		List    string `json:"_list"`
		Rewrite string `json:"_rewrite"`
		Show    string `json:"_show"`
		Update  string `json:"_update"`
		View    string `json:"_view"`
	} `json:"httpd_design_handlers"`
	HttpdGlobalHandlers struct {
		NAMING_FAILED string `json:"/"`
		ActiveTasks   string `json:"_active_tasks"`
		AllDbs        string `json:"_all_dbs"`
		Config        string `json:"_config"`
		Log           string `json:"_log"`
		Oauth         string `json:"_oauth"`
		Replicate     string `json:"_replicate"`
		Restart       string `json:"_restart"`
		Session       string `json:"_session"`
		Stats         string `json:"_stats"`
		Utils         string `json:"_utils"`
		Uuids         string `json:"_uuids"`
		FaviconIco    string `json:"favicon.ico"`
	} `json:"httpd_global_handlers"`
	Log struct {
		File        string `json:"file"`
		IncludeSasl string `json:"include_sasl"`
		Level       string `json:"level"`
	} `json:"log"`
	QueryServerConfig struct {
		ReduceLimit string `json:"reduce_limit"`
	} `json:"query_server_config"`
	QueryServers struct {
		Javascript string `json:"javascript"`
	} `json:"query_servers"`
	Replicator struct {
		MaxHTTPPipelineSize string `json:"max_http_pipeline_size"`
		MaxHTTPSessions     string `json:"max_http_sessions"`
	} `json:"replicator"`
	Stats struct {
		Rate    string `json:"rate"`
		Samples string `json:"samples"`
	} `json:"stats"`
	Uuids struct {
		Algorithm string `json:"algorithm"`
	} `json:"uuids"`
}

type ConfigSectionResponse struct {
	ErrorResponse
	AllowJsonp             string `json:"allow_jsonp"`
	AuthenticationHandlers string `json:"authentication_handlers"`
	BindAddress            string `json:"bind_address"`
	DefaultHandler         string `json:"default_handler"`
	EnableCors             string `json:"enable_cors"`
	LogMaxChunkSize        string `json:"log_max_chunk_size"`
	Port                   string `json:"port"`
	SecureRewrites         string `json:"secure_rewrites"`
	VhostGlobalHandlers    string `json:"vhost_global_handlers"`
}

type client struct {
	*CouchDb2ConnDetails
}

func (s *client) Meta() (res *MetaResponse, err error) {
	err = s.requester(http.MethodGet, "/", nil, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

func (s *client) ActiveTasks() (*ActiveTasksResponse, error) {
	var res ActiveTasksResponse
	err := s.requester(http.MethodGet, "/_active_tasks", nil, &res)

	//TODO ActiveTasks call can return an array of strings or a JSON error. We aren't handling error case

	return &res, err
}

func (s *client) AllDbs() (*AllDbsResponse, error) {
	var res AllDbsResponse
	err := s.requester(http.MethodGet, "/_all_dbs", nil, &res)

	//TODO AllDbs call can return an array of strings or a JSON error. We aren't handling error case

	return &res, err
}

func (s *client) DbUpdates(r *DbUpdatesRequest) (res *DbUpdatesResponse, err error) {
	requestBytes, err := json.Marshal(r)
	if err != nil {
		err = fmt.Errorf("Error creating request JSON: %s", err.Error())
		return
	}
	requestReader := bytes.NewReader(requestBytes)
	err = s.requester(http.MethodGet, "/_db_updates", requestReader, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

func (s *client) Membership() (*MembershipResponse, error) {
	var res MembershipResponse
	err := s.requester(http.MethodGet, "/_membership", nil, &res)

	if res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return &res, err
}

func (s *client) Log(r *LogRequest) (res *LogResponse, err error) {
	if s.Client == nil {
		return nil, errors.New("You must set an HTTP Client to make requests. Current client is nil")
	}

	requestBytes, err := json.Marshal(r)
	if err != nil {
		return
	}
	requestReader := bytes.NewReader(requestBytes)

	req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s/_log", s.Address), requestReader)
	if err != nil {
		return
	}

	req.Header.Add("Accept", "application/json")

	httpRes, err := s.Client.Do(req)
	if err != nil {
		return
	}

	byt, err := ioutil.ReadAll(httpRes.Body)
	if err != nil {
		return
	}
	defer httpRes.Body.Close()

	temp := LogResponse(byt)
	res = &temp

	return
}

func (s *client) Replicate() (*ReplicateResponse, error) {
	var res ReplicateResponse
	err := s.requester(http.MethodGet, "/_replicate", nil, &res)

	if res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return &res, err
}

func (s *client) Restart() (*RestartResponse, error) {
	var res RestartResponse
	err := s.requester(http.MethodPost, "/_restart", nil, &res)

	if res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return &res, err
}

func (s *client) Stats() (res *StatsResponse, err error) {
	err = s.requester(http.MethodGet, "/_restart", nil, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

func (s *client) UUIDs(c uint8) (res *UUIDsResponse, err error) {
	err = s.requester(http.MethodGet, "/_restart", nil, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

func (s *client) Config() (res *ConfigResponse, err error) {
	err = s.requester(http.MethodGet, "/_config", nil, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

func (s *client) Section(se string) (res *ConfigSectionResponse, err error) {
	err = s.requester(http.MethodGet, fmt.Sprintf("/_config/%s", se), nil, &res)

	if res != nil && res.ErrorS != "" {
		return nil, &ErrorResponse{
			ErrorS: res.ErrorS,
			Reason: res.Reason,
		}
	}

	return
}

//func (c *server) Key(se, k string) (res *ConfigSectionResponse, err error) {
//	err = c.requester(http.MethodGet, fmt.Sprintf("/_config/%s/%s", se, k), nil, res)
// TODO Key function on server type
//	return
//}
//
//func (c *server) SetKey(se, k string) (res *ConfigSectionResponse, err error) {
//	err = c.requester("PUT", fmt.Sprintf("/_config/%s/%s", se, k), nil, res)
// TODO SetKey function on server type
//	return
//}
//
//func (c *server) DeleteKey(se, k string) (res *ConfigSectionResponse, err error) {
//	err = c.requester("DELETE", fmt.Sprintf("/_config/%s/%s", se, k), nil, res)
// TODO DeleteKey function on server type
//	return
//}

func NewClient(t time.Duration, addr string, user, pass string) (c Client) {
	c = &client{
		CouchDb2ConnDetails: NewConnection(t, addr, user, pass, true),
	}

	return
}

redpajama_set_name: RedPajamaGithub


text:
package obvious.demo.sandbox;

import javax.swing.JFrame;

import obvious.prefuse.data.PrefuseObviousTable;
import obvious.prefuse.viz.PrefuseObviousVisualization;
import obvious.prefuse.viz.util.PrefuseObviousAction;
import obvious.prefuse.viz.util.PrefuseObviousRenderer;
import obvious.viz.Visualization;
import obvious.data.Table;
import prefuse.Constants;
import prefuse.Display;
import prefuse.action.ActionList;
import prefuse.action.RepaintAction;
import prefuse.action.assignment.ColorAction;
import prefuse.action.assignment.DataShapeAction;
import prefuse.action.layout.AxisLayout;
import prefuse.controls.DragControl;
import prefuse.controls.PanControl;
import prefuse.controls.ZoomControl;
import prefuse.data.io.DelimitedTextTableReader;
import prefuse.render.DefaultRendererFactory;
import prefuse.render.ShapeRenderer;
import prefuse.util.ColorLib;
import prefuse.visual.VisualItem;
import prefuse.visual.expression.VisiblePredicate;

/**
 * A simple visualization test of a scatter plot. This example derived
 * from a the ScatterPlot demo of the prefuse toolkit. It uses the same
 * data file and the same actions / renderer. But it's built with Obvious data
 * model and visualization. In this version, it is displayed with prefuse
 * toolkit.
 * In this example, we use the polylithic approach, that's why some prefuse
 * code is present to build action and renderer.
 * @author Hemery
 *
 */
public final class PrefuseTableAndPolylithicPrefuseScatterplotVisDemo {

  /**
   * Private constructor.
   */
  private PrefuseTableAndPolylithicPrefuseScatterplotVisDemo() { }

  /**
   * Main function.
   * @param args arguments
   */
  public static void main(final String[] args) {

    // Load data into a prefuse table.
    prefuse.data.Table prefTable = null;
    try {
        prefTable = new DelimitedTextTableReader().readTable(
            "src/main/resources/fisher.iris.txt");
    } catch (Exception e) {
        e.printStackTrace();
    }
    // Wrapping the prefuse table to an obvious table.
    Table table = new PrefuseObviousTable(prefTable);
    // Creating the obvious visualization.
    Visualization viz = new PrefuseObviousVisualization(table, null, null,
        null);

    // We define all useful field and paramaters (such as group name).
    String xfield = "SepalLength";
    String yfield = "PetalLength";
    String sfield = "Species";
    String group = "tupleset";
    ShapeRenderer mshapeR = new ShapeRenderer(2); // three "kinds" of tuple

    // Setting the default renderer factory then adding it to obvious vis.
    DefaultRendererFactory rf = new DefaultRendererFactory(mshapeR);
    viz.setRenderer(new PrefuseObviousRenderer(rf));

    // Layout definition then adding it to obvious visualization.
    AxisLayout xAxis = new AxisLayout(group, xfield,
        Constants.X_AXIS, VisiblePredicate.TRUE);
    viz.putAction("x", new PrefuseObviousAction(xAxis));

    AxisLayout yAxis = new AxisLayout(group, yfield,
        Constants.Y_AXIS, VisiblePredicate.TRUE);
    viz.putAction("y", new PrefuseObviousAction(yAxis));

    ColorAction color = new ColorAction(group,
        VisualItem.STROKECOLOR, ColorLib.rgb(100,100,255));
    viz.putAction("color", new PrefuseObviousAction(color));

    DataShapeAction shape = new DataShapeAction(group, sfield);
    viz.putAction("shape", new PrefuseObviousAction(shape));
    // Building the action list, then add it to obvious visualization.
    ActionList draw = new ActionList();
    draw.add(xAxis);
    draw.add(yAxis);
    if (sfield != null) {
        draw.add(shape);
    }
    draw.add(color);
    draw.add(new RepaintAction());
    viz.putAction("draw", new PrefuseObviousAction(draw));

    // In order to display, we have to call the underlying prefuse
    // visualization.
    // In a complete version of obvious, we don't need that step.
    prefuse.Visualization prefViz = (prefuse.Visualization)
    viz.getUnderlyingImpl(prefuse.Visualization.class);

    // Building the prefuse display.
    Display display = new Display(prefViz);
    display.setSize(300, 200);
    display.addControlListener(new DragControl());
    display.addControlListener(new PanControl());
    display.addControlListener(new ZoomControl());

    // Jframe...
    JFrame frame = new JFrame("Data model : obvious-prefuse |"
        + " Visualisation : obvious-prefuse | View Prefuse | Polylithic");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(display);
    frame.pack();
    frame.setVisible(true);
    prefViz.run("draw");
  }

}


text:
#include "frontend/frontend_server_handler.h"

#include "nebula/base/id_util.h"
#include "nebula/base/time_util.h"

#include "proto/mtproto/core/auth_key_manager.h"
#include "proto/mtproto/core/mtproto_schema.h"
#include "base/message_handler_util.h"

using namespace mtproto;

inline uint32_t GetServerID() {
  return 1;
}

///////////////////////////////////////////////////////////////////////////////////////
int FrontendServerHandler::OnNewConnectionCallback(nebula::TcpServiceBase* service, nebula::MTProtoPipeline* pipeline) {
  auto h = pipeline->getHandler<MTProtoHandler>();
  DCHECK(h);

  auto handler = std::make_shared<FrontendServerHandler>(service, pipeline, h->GetConnID());
  h->SetAttachData(handler);

  return handler->OnNewConnection();
}

int FrontendServerHandler::OnDataReceivedCallback(nebula::MTProtoPipeline* pipeline, std::unique_ptr<folly::IOBuf> message_data) {
  auto h = pipeline->getHandler<MTProtoHandler>();
  DCHECK(h);

  auto handler = h->CastByGetAttachData<FrontendServerHandler>();

  if (!handler) {
    LOG(ERROR) << "OnDataReceived - CastByGetAttachData";
    return -1;
  }

  return handler->OnDataReceived(std::forward<std::unique_ptr<folly::IOBuf>>(message_data));
}

int FrontendServerHandler::OnConnectionClosedCallback(nebula::TcpServiceBase* service, nebula::MTProtoPipeline* pipeline) {
  auto h = pipeline->getHandler<MTProtoHandler>();
  DCHECK(h);

  auto handler = h->CastByGetAttachData<FrontendServerHandler>();

  if (!handler) {
    LOG(ERROR) << "OnConnectionClosed - CastByGetAttachData";
    return -1;
  }

  return handler->OnConnectionClosed();
}

///////////////////////////////////////////////////////////////////////////////////////
int FrontendServerHandler::OnNewConnection() {
  state_ = State::CONNECTED;
  // TODO(@benqi):
  // 启动定时器,一段时间内如果没有收到任何消息,
  // 则认为可能是攻击数据包,关闭连接并记录审计日志IP
  return 0;
}

int FrontendServerHandler::OnDataReceived(std::unique_ptr<folly::IOBuf> message_data) {
  // TODO(@benqi): 后续处理如果比较复杂,可以使用状态机模式

  auto buf_length = message_data->computeChainDataLength();
  LOG(INFO) << "OnDataReceived - recv data, length = " << buf_length;

  // std::shared_ptr<MTProtoBase> mtproto;
  int rv = -1;
  do {
    // QuickAckSize
    if (buf_length == mtproto::kMTProtoQuickAckSize) {
      auto mtproto = std::make_shared<mtproto::MTProtoQuickAck>();
      if (!mtproto->ParseFromIOBuf(std::move(message_data))) {
        LOG(ERROR) << "OnDataReceived - read MTProto error!!!!";
        break;
      }
      OnMTProtoQuickAck(mtproto);
    } else if (buf_length < mtproto::kMTProtoMessageMinSize) {
      // 至少要读出auth_key_id
      LOG(ERROR) << "OnDataReceived - need " << kMTProtoMessageMinSize << ", but only recv len: " << buf_length;
      // ctx->fireReadException(folly::make_exception_wrapper<std::runtime_error>("read - auth_key_id parser error!!!!"));
      break;
    } else {
      folly::io::Cursor c2(message_data.get());
      int64_t key_id = c2.readLE<int64_t>();

      if (key_id == 0) {
        if (buf_length < kMTProtoUnEncryptedHeaderSize) {
          LOG(ERROR) << "OnDataReceived - need " << kMTProtoUnEncryptedHeaderSize << ", but only recv len: " << buf_length;
          break;
        }
        auto mtproto = std::make_shared<MTProtoUnencryptedMessage>();
        if (!mtproto->ParseFromIOBuf(std::move(message_data))) {
          LOG(ERROR) << "OnDataReceived - read MTProto error!!!!";
          // ctx->fireReadException(folly::make_exception_wrapper<std::runtime_error>("read - MTProtoUnencryptedMessage parser error!!!!"));
          break;
        }
        LOG(INFO) << "OnDataReceived - unencrypted message: " << mtproto->ToString();
        OnMTProtoUnencryptedMessage(mtproto);
      } else {
        LOG(INFO) << "OnDataReceived - recv key_id: " << key_id;
        if (buf_length < kMTProtoEncryptedHeaderSize) {
          LOG(ERROR) << "OnDataReceived - need " << kMTProtoEncryptedHeaderSize << ", but only recv len: " << buf_length;
          break;
        }

        // TODO(@benqi): 检查状态
        //
        if (auth_key_id_ == 0) {
          auto key = AuthKeyManager::GetInstance()->FindAuthKey(key_id);
          if (!key) {
            LOG(ERROR) << "OnDataReceived - Can't find key_id: " << key_id;
            // ctx->fireReadException(folly::make_exception_wrapper<std::runtime_error>("read - auth_key_id error!!!!"));
            break;
          }
          auth_key_ = key;
          auth_key_id_ = key_id;

          // AuthKeyManager::GetInstance()->SetAuthKey(key, key_id);
        }

        auto mtproto = std::make_shared<MTProtoEncryptedMessage>(auth_key_, auth_key_id_);
        if (!mtproto->ParseFromIOBuf(std::move(message_data))) {
          LOG(ERROR) << "OnDataReceived - read MTProto error!!!!";
          // ctx->fireReadException(folly::make_exception_wrapper<std::runtime_error>("read - MTProtoEncryptedMessage parser error!!!!"));
          break;
        }

        LOG(INFO) << "OnDataReceived - read encrypted message: " << mtproto->ToString();

        if (session_id_ == 0) {
          session_id_ = mtproto->session_id;
        } else if (session_id_ != mtproto->session_id) {
          LOG(ERROR) << "read - maybe session_id invalid, session_id is " << session_id_;
        }

        session_id_ = mtproto->session_id;
        OnMTProtoEncryptedMessage(mtproto);
      }
    }
    rv = 0;
  } while(0);

  return rv;
}

int FrontendServerHandler::OnConnectionClosed() {
/*
  if (state_ >= State::AUTH) {
    NotifyClientOffline();
  }
 */

  state_ = State::CLOSING;
  return 0;
}

void FrontendServerHandler::Close(int reason) {
  pipeline_->close();
}

void FrontendServerHandler::OnMTProtoQuickAck(std::shared_ptr<MTProtoQuickAck> mproto) {
  LOG(INFO) << "read - recv QuickAckID";
}

void FrontendServerHandler::OnMTProtoUnencryptedMessage(std::shared_ptr<MTProtoUnencryptedMessage> mproto) {
  // 首包处理
  if (is_first_message_) {
    // 如果首包是未加密消息,则走handshake流程
    state_ = State::HANDSHAKE;
    is_first_message_ = false;
    handshake_ = std::make_shared<HandshakeHandler>(this);
  }

  std::shared_ptr<TLObject> obj(TLObject::CreateObjectByIOBuf(mproto->GetMessageData()));

  // TODO(@benqi): 数据包或状态有问题,关闭连接
  if (!obj) {
    LOG(ERROR) << "OnMTProtoUnencryptedMessage - not create object: ";
    return;
  }

  if (obj->GetClassID() == TL_msgs_ack::CLASS_ID) {
    On_TL_msgs_ack(obj);
    return;
  }

  // TODO(@benqi): 检查state
  TLObjectPtr result;

  switch (obj->GetClassID()) {
    case TL_req_pq::CLASS_ID :
    case TL_req_DH_params::CLASS_ID:
    case TL_set_client_DH_params::CLASS_ID:
      DCHECK(handshake_.get());
      DCHECK(state_==State::HANDSHAKE);
      result = handshake_->OnHandshake(obj);
      break;
    case TL_destroy_auth_key::CLASS_ID:
      result = On_TL_destroy_auth_key(obj);
      break;
    default:
      break;
  }

  if (!result) {
    LOG(ERROR) << "OnMTProtoUnencryptedMessage - ";
    return;
  }

  MTProtoUnencryptedMessage rsp(result);
  std::unique_ptr<folly::IOBuf> o;
  rsp.SerializeToIOBuf(o);
  pipeline_->write(std::move(o));

  // TODO(@benqi): delete handshake_
}

void FrontendServerHandler::OnMTProtoEncryptedMessage(std::shared_ptr<MTProtoEncryptedMessage> mproto) {
  // 首包处理
  if (is_first_message_) {
    // conn_state_ = RPC_RUNNING;
    is_first_message_ = false;
  }

  if (state_ == State::AUTH_KEY_CREATED) {
    // TODO(@benqi): delete handshake
  }

  // auth_key_id_ = mproto->auth_key_id;
  std::shared_ptr<TLObject> obj(TLObject::CreateObjectByIOBuf(mproto->GetMessageData()));
  // TODO(@benqi): 数据包或状态有问题,关闭连接
  if (!obj) {
    LOG(ERROR) << "OnMTProtoEncryptedMessage - not create object: ";
    return;
  }

  try {
    LOG(INFO) << "OnMTProtoEncryptedMessage - recv tl_object: " << obj->ToString();
  } catch (std::exception& e) {
    int r=0;
    r = 1;
  } catch (...) {
    int r=0;
    r = 1;
  }

  if (obj->GetClassID() == TL_msgs_ack::CLASS_ID) {
    On_TL_msgs_ack(obj);
    return;
  }

  TLObjectPtr result;

  switch (obj->GetClassID()) {
    case TL_ping::CLASS_ID :
      result = On_TL_ping(obj);
      break;
    case TL_ping_delay_disconnect::CLASS_ID :
      result = On_TL_ping_delay_disconnect(obj);
      break;
    case TL_destroy_session::CLASS_ID :
      result = On_TL_destroy_session(obj);
      break;
    case TL_get_future_salts::CLASS_ID :
      result = On_TL_get_future_salts(obj);
      break;
    case TL_rpc_drop_answer::CLASS_ID :
      result = On_TL_rpc_drop_answer(obj);
      break;

    case TL_contest_saveDeveloperInfo::CLASS_ID :
      result = On_TL_contest_saveDeveloperInfo(obj);
      break;
    case TL_invokeWithLayer::CLASS_ID:
      result = On_TL_invokeWithLayer(obj, mproto->message_id, mproto->seq_no);
      return;
      break;
    case TL_invokeAfterMsg::CLASS_ID:
      result = On_TL_invokeAfterMsg(obj, mproto->message_id, mproto->seq_no);
      return;
      break;
    case TL_msg_container::CLASS_ID :
      result = On_TL_msg_container(obj);
      break;
    case TL_gzip_packed::CLASS_ID:
      result = On_TL_gzip_packed(obj);
      break;
    // case TL_msgs_ack::CLASS_ID:
    //  result = On_TL_msgs_ack(obj);
    //  break;

    default:
      result = On_TL_api_message_request(obj, mproto->message_id, mproto->seq_no);
      return;
      // RPC
      break;
  }

  if (!result) {
    LOG(ERROR) << "OnMTProtoEncryptedMessage - ";
    return;
  }

  // session_id
  MTProtoEncryptedMessage rsp(auth_key_, auth_key_id_, session_id_, mproto->seq_no, result);
  std::unique_ptr<folly::IOBuf> o;
  rsp.SerializeToIOBuf(o);
  pipeline_->write(std::move(o));
}

void FrontendServerHandler::On_TL_msgs_ack(TLObjectPtr msg) {
  // TODO(@beni): 暂时不实现
}

TLObjectPtr FrontendServerHandler::On_TL_destroy_auth_key(TLObjectPtr msg) {
  TLObjectPtr result;
  return result;
}

/*
 Request for several future salts
 The client may at any time request from the server several
 (between 1 and 64) future server salts together with their validity periods.
 Having stored them in persistent memory,
 the client may use them to send messages in the future even
 if he changes sessions (a server salt is attached to
 the authorization key rather than being session-specific).

 get_future_salts#b921bd04 num:int = FutureSalts;
 future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
 future_salts#ae500895 req_msg_id:long now:int salts:vector future_salt = FutureSalts;
 The client must check to see that the response's req_msg_id in fact
 coincides with msg_id of the query for get_future_salts.
 The server returns a maximum of num future server salts (may return fewer).
 The response serves as the acknowledgment of the query and does not require an acknowledgment itself.
 */
TLObjectPtr FrontendServerHandler::On_TL_get_future_salts(TLObjectPtr msg) {
  auto get_future_salts = std::static_pointer_cast<TL_get_future_salts>(msg);
  LOG(INFO) << "On_TL_get_future_salts - " << get_future_salts->ToString();

  // TODO(@benqi): 暂时不实现
  std::shared_ptr<TL_future_salts> future_salts;
  // = std::make_shared<TL_future_salts>();
  // TODO(@benqi): set_msg_id
  // pong->set_ping_id(ping_delay_disconnect->ping_id());
  return future_salts;
}

////////////////////////////////////////////////////////////////////////////////////////////
TLObjectPtr FrontendServerHandler::On_TL_ping_delay_disconnect(TLObjectPtr msg) {
  // TODO(@benqi): delay disconnect
  auto ping_delay_disconnect = std::static_pointer_cast<TL_ping_delay_disconnect>(msg);
  LOG(INFO) << "On_TL_ping_delay_disconnect - " << ping_delay_disconnect->ToString();

  auto pong = std::make_shared<TL_pong>();
  // TODO(@benqi): set_msg_id
  pong->set_ping_id(ping_delay_disconnect->ping_id());
  return pong;
}

TLObjectPtr FrontendServerHandler::On_TL_ping(TLObjectPtr msg) {
  auto ping = std::static_pointer_cast<TL_ping>(msg);

  LOG(INFO) << "On_TL_ping - " << ping->ToString();

  auto pong = std::make_shared<TL_pong>();
  pong->set_ping_id(ping->ping_id());
  return pong;
}

// Used by the client to notify the server
// that it may forget the data from a different session belonging to the same user (i. e. with the same auth_key_id).
// The result of this being applied to the current session is undefined.
TLObjectPtr FrontendServerHandler::On_TL_destroy_session(TLObjectPtr msg) {
  LOG(INFO) << "On_TL_destroy_session - " << msg->ToString();
  // r = On_TL_destroy_session(ctx, msg);
  auto destroy_session = std::static_pointer_cast<TL_destroy_session>(msg);
  auto destroy_session_ok = std::make_shared<TL_destroy_session_ok>();
  destroy_session_ok->set_session_id(destroy_session->session_id());
  return destroy_session_ok;
}

TLObjectPtr FrontendServerHandler::On_TL_contest_saveDeveloperInfo(TLObjectPtr msg) {
  auto contest_saveDeveloperInfo = std::static_pointer_cast<TL_contest_saveDeveloperInfo>(msg);
  contest_saveDeveloperInfo->vk_id();
  contest_saveDeveloperInfo->name();
  contest_saveDeveloperInfo->phone_number();
  contest_saveDeveloperInfo->age();
  contest_saveDeveloperInfo->city();

  auto rv = std::make_shared<TL_true>();
  return rv;
}

TLObjectPtr FrontendServerHandler::On_TL_invokeWithLayer(TLObjectPtr msg, int64_t message_id, int seq_no) {
  TLObjectPtr r;
  auto invoke_with_layer = std::static_pointer_cast<TL_invokeWithLayer>(msg);
  LOG(INFO) << "On_TL_invokeWithLayer - TL_invokeWithLayer's layer: " << invoke_with_layer->layer();

  auto x = invoke_with_layer->query();
  if (!x) {
    LOG(INFO) << "On_TL_invokeWithLayer - query is nil";
    return r;
  }

  LOG(INFO) << "On_TL_invokeWithLayer - TL_invokeWithLayer's query: " << invoke_with_layer->query()->ToString();
  On_TL_initConnection(invoke_with_layer->query(), message_id, seq_no);
  // r = OnRpcData(ctx, x);
  return r;
}

TLObjectPtr FrontendServerHandler::On_TL_invokeAfterMsg(TLObjectPtr msg, int64_t message_id, int seq_no) {
  TLObjectPtr r;
  auto invoke_after_msg = std::static_pointer_cast<TL_invokeAfterMsg>(msg);
  LOG(INFO) << "On_TL_invokeAfterMsg - TL_invokeAfterMsg layer: " << invoke_after_msg->msg_id();

  auto query = invoke_after_msg->query();
  if (!query) {
    LOG(INFO) << "On_TL_invokeAfterMsg - query is nil";
    return r;
  }

  LOG(INFO) << "On_TL_invokeAfterMsg - TL_invokeAfterMsg query: " << invoke_after_msg->query()->ToString();

  std::unique_ptr<folly::IOBuf> o;
  query->SerializeToIOBuf(o);

  auto rpc_request = std::make_shared<zproto::RpcRequest>(query->GetClassID(), std::move(o));

  //  if (encoded->GetMethodID() != CRC32("zproto.StartTestingAuthReq")) {
  //    LOG(ERROR) << "OnDataReceived - Will recv StartTestingAuthReq, method_id: " << CRC32("zproto.StartTestingAuthReq")
  //    << ", but recv a invalid method_id: " << encoded->ToString();
  //    Close(0);
  //    return 0;
  //  }

  // TODO(@benqi): S2SAttachData其它数据设置
  rpc_request->set_message_id(message_id);
  rpc_request->seq_num = seq_no;
  rpc_request->set_session_id(session_id_);
  rpc_request->set_birth_conn_id(conn_id_);
  rpc_request->set_birth_server_id(GetServerID());
  rpc_request->set_birth_track_uuid(GetNextIDBySnowflake());
  rpc_request->set_birth_timetick(NowInMsecTime());
  rpc_request->set_birth_remote_ip(pipeline_->getHandler<MTProtoHandler>()->GetRemoteAddress());
  rpc_request->set_birth_from("frontend_server");

  // TODO(@benqi): 借鉴RPC
  LOG(INFO) << "On_TL_invokeAfterMsg - will send rpc_request: " << rpc_request->ToString();
  WritePackage("messenger_client", rpc_request);
  return r;
}

void FrontendServerHandler::On_TL_initConnection(const mtproto::TLObject* query, int64_t message_id, int seq_no) {
  const mtproto::TL_initConnection* init_connections = dynamic_cast<const mtproto::TL_initConnection*>(query);
  LOG(INFO) << "On_TL_initConnection - dispatch query to messenger_client: " << init_connections->query()->ToString();

  std::unique_ptr<folly::IOBuf> o;
  init_connections->query()->SerializeToIOBuf(o);

  auto rpc_request = std::make_shared<zproto::RpcRequest>(init_connections->query()->GetClassID(), std::move(o));

  //  if (encoded->GetMethodID() != CRC32("zproto.StartTestingAuthReq")) {
  //    LOG(ERROR) << "OnDataReceived - Will recv StartTestingAuthReq, method_id: " << CRC32("zproto.StartTestingAuthReq")
  //    << ", but recv a invalid method_id: " << encoded->ToString();
  //    Close(0);
  //    return 0;
  //  }

  // TODO(@benqi): S2SAttachData其它数据设置
  rpc_request->set_message_id(message_id);
  rpc_request->seq_num = seq_no;
  rpc_request->set_session_id(session_id_);
  rpc_request->set_birth_conn_id(conn_id_);
  rpc_request->set_birth_server_id(GetServerID());
  rpc_request->set_birth_track_uuid(GetNextIDBySnowflake());
  rpc_request->set_birth_timetick(NowInMsecTime());
  rpc_request->set_birth_remote_ip(pipeline_->getHandler<MTProtoHandler>()->GetRemoteAddress());
  rpc_request->set_birth_from("frontend_server");

  // TODO(@benqi): 借鉴RPC
  LOG(INFO) << "On_TL_initConnection - will send rpc_request: " << rpc_request->ToString();
  WritePackage("messenger_client", rpc_request);
}

TLObjectPtr FrontendServerHandler::On_TL_msg_container(TLObjectPtr msg) {
  // TLObjectPtr result;
  TLObjectPtr rsp;

  auto msg_container = std::static_pointer_cast<TL_msg_container>(msg);

  LOG(INFO) << "On_TL_msg_container - " << msg_container->ToString();
  for (size_t i=0; i<msg_container->messages_size(); ++i) {
    auto message2 = msg_container->messages(i);
    LOG(INFO) << "On_TL_msg_container - message2: idx = " << i << ", "; //  << message2->ToString();

//    auto r = OnRpcData(ctx, message2->body());
//    if (r) {
//      if (r->GetClassID() == TL_auth_sentCode::CLASS_ID ||
//          r->GetClassID() == TL_auth_authorization::CLASS_ID ||
//          r->GetClassID() == TL_config::CLASS_ID) {
//
//        auto rpc_result = std::make_shared<TL_rpc_result>();
//        rpc_result->set_req_msg_id(message2->msg_id());
//        rpc_result->set_result(r);
//
//        auto r_mtproto = std::make_shared<MTProtoEncryptedMessage>(auth_key_,
//                                                                   auth_key_id_,
//                                                                   session_id_,
//                                                                   message2->seqno(),
//                                                                   rpc_result);
//        std::unique_ptr<folly::IOBuf> out;
//        r_mtproto->SerializeToIOBuf(out);
//        if (out) {
//          write(ctx, std::move(out));
//        }
//      } else {
//        auto r_mtproto = std::make_shared<MTProtoEncryptedMessage>(auth_key_,
//                                                                   auth_key_id_,
//                                                                   session_id_,
//                                                                   message2->seqno(),
//                                                                   r);
//        std::unique_ptr<folly::IOBuf> out;
//        r_mtproto->SerializeToIOBuf(out);
//        if (out) {
//          write(ctx, std::move(out));
//        }
//      }
//    }
  }
  return rsp;
  // return result;
}

TLObjectPtr FrontendServerHandler::On_TL_gzip_packed(TLObjectPtr msg) {
  TLObjectPtr result;
  return result;
}

TLObjectPtr FrontendServerHandler::On_TL_rpc_drop_answer(TLObjectPtr msg) {
  TLObjectPtr result;
  return result;
}

// main api
TLObjectPtr FrontendServerHandler::On_TL_api_message_request(TLObjectPtr msg, int64_t message_id, int seq_no) {
  LOG(INFO) << "On_TL_api_message_request - dispatch api to messenger_client: " << msg->ToString();

  TLObjectPtr result;

  std::unique_ptr<folly::IOBuf> o;
  msg->SerializeToIOBuf(o);

  auto rpc_request = std::make_shared<zproto::RpcRequest>(msg->GetClassID(), std::move(o));

//  if (encoded->GetMethodID() != CRC32("zproto.StartTestingAuthReq")) {
//    LOG(ERROR) << "OnDataReceived - Will recv StartTestingAuthReq, method_id: " << CRC32("zproto.StartTestingAuthReq")
//    << ", but recv a invalid method_id: " << encoded->ToString();
//    Close(0);
//    return 0;
//  }

  // TODO(@benqi): S2SAttachData其它数据设置
  rpc_request->set_message_id(message_id);
  rpc_request->seq_num = seq_no;
  rpc_request->set_session_id(session_id_);
  rpc_request->set_birth_conn_id(conn_id_);
  rpc_request->set_birth_server_id(GetServerID());
  rpc_request->set_birth_track_uuid(GetNextIDBySnowflake());
  rpc_request->set_birth_timetick(NowInMsecTime());
  rpc_request->set_birth_remote_ip(pipeline_->getHandler<MTProtoHandler>()->GetRemoteAddress());
  rpc_request->set_birth_from("frontend_server");
  LOG(INFO) << "On_TL_api_message_request - will send rpc_request: " << rpc_request->ToString();
  // TODO(@benqi): 借鉴RPC
  WritePackage("messenger_client", rpc_request);

  return result;
}

void FrontendServerHandler::OnMessengerClientDataArrived(std::shared_ptr<zproto::ProtoRpcResponse> message_data) {
  std::shared_ptr<mtproto::TLObject> rpc_result;

  if (message_data->GetPackageType() != zproto::RpcOk::HEADER) {
    // return;
    auto rpc_error = std::make_shared<mtproto::TL_rpc_error>();
    rpc_error->set_error_code(-1);
    if (message_data->GetPackageType() == zproto::RpcInternalError::HEADER) {
      rpc_error->set_error_code(-2);
    } else if (message_data->GetPackageType() == zproto::RpcError::HEADER) {
      rpc_error->set_error_code(std::static_pointer_cast<zproto::RpcError>(message_data)->error_code);
    }
    rpc_result = rpc_error;
  } else {
    auto rpc_ok = std::static_pointer_cast<zproto::RpcOk>(message_data);
    auto rpc_result2 = std::make_shared<mtproto::TL_rpc_result>();
    rpc_result2->set_req_msg_id(rpc_ok->req_message_id);
    auto obj = TLObjectFactory::CreateSharedInstance(rpc_ok->GetMethodResponseID());
    obj->ParseFromIOBuf(rpc_ok->body.get());

    LOG(INFO) << "OnMessengerClientDataArrived - rpc_ok: " << obj->ToString();

    rpc_result2->set_result(obj);
    rpc_result = rpc_result2;
  }

  MTProtoEncryptedMessage rsp(auth_key_,
                              auth_key_id_,
                              message_data->session_id(),
                              message_data->seq_num,
                              rpc_result);
  std::unique_ptr<folly::IOBuf> o;
  rsp.SerializeToIOBuf(o);
  pipeline_->write(std::move(o));
}


text:
using System;
using NSpectator;
using NSpectator.Domain;
using NSpectator.Specs.Running;
using NUnit.Framework;
using FluentAssertions;

namespace NSpectator.Specs.Running.Exceptions
{
    [TestFixture]
    [Category("RunningSpecs")]
    public class When_before_contains_exception : When_running_specs
    {
        class SpecClass : Spec
        {
            void method_level_context()
            {
                Before = () => { throw new BeforeException(); };

                It["should fail this example because of before"] = () => "1".Should().Be("1");

                It["should also fail this example because of before"] = () => "1".Should().Be("1");

                It["overrides exception from same level it"] = () => { throw new ItException(); };

                Context["exception thrown by both before and nested before"] = () =>
                {
                    Before = () => { throw new NestedBeforeException(); };

                    It["overrides exception from nested before"] = () => "1".Should().Be("1");
                };

                Context["exception thrown by both before and nested act"] = () =>
                {
                    Act = () => { throw new ActException(); };

                    It["overrides exception from nested act"] = () => "1".Should().Be("1");
                };

                Context["exception thrown by both before and nested it"] = () =>
                {
                    It["overrides exception from nested it"] = () => { throw new ItException(); };
                };

                Context["exception thrown by both before and nested after"] = () =>
                {
                    It["overrides exception from nested after"] = () => "1".Should().Be("1");

                    After = () => { throw new AfterException(); };
                };
            }
        }

        [SetUp]
        public void setup()
        {
            Run(typeof(SpecClass));
        }

        [Test]
        public void the_example_level_failure_should_indicate_a_context_failure()
        {
            TheExample("should fail this example because of before")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("should also fail this example because of before")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("overrides exception from same level it")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("overrides exception from nested before")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("overrides exception from nested act")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("overrides exception from nested it")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
            TheExample("overrides exception from nested after")
                .Exception.GetType().Should().Be(typeof(ExampleFailureException));
        }

        [Test]
        public void examples_with_only_before_failure_should_fail_because_of_before()
        {
            TheExample("should fail this example because of before")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
            TheExample("should also fail this example because of before")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }

        [Test]
        public void it_should_throw_exception_from_before_not_from_same_level_it()
        {
            TheExample("overrides exception from same level it")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }

        [Test]
        public void it_should_throw_exception_from_before_not_from_nested_before()
        {
            TheExample("overrides exception from nested before")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }

        [Test]
        public void it_should_throw_exception_from_before_not_from_nested_act()
        {
            TheExample("overrides exception from nested act")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }

        [Test]
        public void it_should_throw_exception_from_before_not_from_nested_it()
        {
            TheExample("overrides exception from nested it")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }

        [Test]
        public void it_should_throw_exception_from_before_not_from_nested_after()
        {
            TheExample("overrides exception from nested after")
                .Exception.InnerException.GetType().Should().Be(typeof(BeforeException));
        }
    }
}


text:
package com.badlogic.gdx.backends.iosrobovm;

import com.badlogic.gdx.utils.ObjectMap;

import org.robovm.apple.glkit.GLKViewDrawableColorFormat;
import org.robovm.apple.glkit.GLKViewDrawableDepthFormat;
import org.robovm.apple.glkit.GLKViewDrawableMultisample;
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
import org.robovm.apple.uikit.UIRectEdge;

public class IOSApplicationConfiguration {
	/** whether to enable screen dimming. */
	public boolean preventScreenDimming = true;
	/** whether or not portrait orientation is supported. */
	public boolean orientationPortrait = true;
	/** whether or not landscape orientation is supported. */
	public boolean orientationLandscape = true;

	/** the color format, RGB565 is the default **/
	public GLKViewDrawableColorFormat colorFormat = GLKViewDrawableColorFormat.RGB565;

	/** the depth buffer format, Format16 is default **/
	public GLKViewDrawableDepthFormat depthFormat = GLKViewDrawableDepthFormat._16;

	/** the stencil buffer format, None is default **/
	public GLKViewDrawableStencilFormat stencilFormat = GLKViewDrawableStencilFormat.None;

	/** the multisample format, None is default **/
	public GLKViewDrawableMultisample multisample = GLKViewDrawableMultisample.None;

	/** number of frames per second, 60 is default **/
	public int preferredFramesPerSecond = 60;

	/** Scale factor to use on large screens with retina display, i.e. iPad 3+ (has no effect on non-retina screens).
	 *

	 *
1.0 = no scaling (everything is in pixels)
	 *
0.5 = LibGDX will behave as you would only have half the pixels. I.e. instead of 2048x1536 you will work in 1024x768.
	 * This looks pixel perfect and will save you the trouble to create bigger graphics for the retina display.
	 *
any other value: scales the screens according to your scale factor. A scale factor oof 0.75, 0.8, 1.2, 1.5 etc. works
	 * very well without any artifacts!
	 *
 */
	public float displayScaleLargeScreenIfRetina = 1.0f;
	/** Scale factor to use on small screens with retina display, i.e. iPhone 4+, iPod 4+ (has no effect on non-retina screens).
	 *

	 *
1.0 = no scaling (everything is in pixels)
	 *
0.5 = LibGDX will behave as you would only have half the pixels. I.e. instead of 960x640 you will work in 480x320. This
	 * looks pixel perfect and will save you the trouble to create bigger graphics for the retina display.
	 *
any other value: scales the screens according to your scale factor. A scale factor of 0.75, 0.8, 1.2, 1.5 etc. works
	 * very well without any artifacts!
	 *
 */
	public float displayScaleSmallScreenIfRetina = 1.0f;
	/** Scale factor to use on large screens without retina display, i.e. iPad 1+2 (has no effect on retina screens).
	 *

	 *
1.0 = no scaling (everything is in pixels)
	 *
any other value: scales the screens according to your scale factor. A scale factor of 0.75, 0.8, 1.2, 1.5 etc. works
	 * very well without any artifacts!
	 *
 */
	public float displayScaleLargeScreenIfNonRetina = 1.0f;
	/** Scale factor to use on small screens without retina display, i.e. iPhone 1-3, iPod 1-3 (has no effect on retina screens).
	 *

	 *
1.0 = no scaling (everything is in pixels)
	 *
any other value: scales the screens according to your scale factor. A scale factor of 0.75, 0.8, 1.2, 1.5 etc. works
	 * very well without any artifacts!
	 *
 */
	public float displayScaleSmallScreenIfNonRetina = 1.0f;

	/** whether to use the accelerometer, default true **/
	public boolean useAccelerometer = true;
	/** the update interval to poll the accelerometer with, in seconds **/
	public float accelerometerUpdate = 0.05f;
	/** the update interval to poll the magnetometer with, in seconds **/
	public float magnetometerUpdate = 0.05f;

	/** whether to use the compass, default true **/
	public boolean useCompass = true;

	/** whether or not to allow background music from iPod **/
	public boolean allowIpod = true;

	/** whether or not the onScreenKeyboard should be closed on return key **/
	public boolean keyboardCloseOnReturn = true;

	/** Experimental, whether to enable OpenGL ES 3 if supported. If not supported it will fall-back to OpenGL ES 2.0.
	 *  When GL ES 3 is enabled, {@link com.badlogic.gdx.Gdx#gl30} can be used to access it's functionality.
	 * @deprecated this option is currently experimental and not yet fully supported, expect issues. */
	@Deprecated public boolean useGL30 = false;

	/** whether the status bar should be visible or not **/
	public boolean statusBarVisible = false;

	/** whether the home indicator should be hidden or not **/
	public boolean hideHomeIndicator = true;

	/** Whether to override the ringer/mute switch, see https://github.com/libgdx/libgdx/issues/4430 */
	public boolean overrideRingerSwitch = false;

	/** Edges where app gestures must be fired over system gestures.
	 * Prior to iOS 11, UIRectEdge.All was default behaviour if status bar hidden, see https://github.com/libgdx/libgdx/issues/5110 **/
	public UIRectEdge screenEdgesDeferringSystemGestures = UIRectEdge.None;

	/** The maximum number of threads to use for network requests. Default is {@link Integer#MAX_VALUE}. */
	public int maxNetThreads = Integer.MAX_VALUE;

	/** whether to use audio or not. Default is true **/
	public boolean useAudio = true;

	ObjectMap<String, IOSDevice> knownDevices = IOSDevice.populateWithKnownDevices();

	/**
	 * adds device information for newer iOS devices, or overrides information for given ones
	 * @param classifier human readable device classifier
	 * @param machineString machine string returned by iOS
	 * @param ppi device's pixel per inch value
	 */
	public void addIosDevice(String classifier, String machineString, int ppi) {
		IOSDevice.addDeviceToMap(knownDevices, classifier, machineString, ppi);
	}
}


text:
def assert_validation_error(response, field, code):
    assert 'error' in response
    error = response['error']

    assert 'detail' in error
    detail = error['detail']

    assert field in detail
    items = detail[field]

    found = False
    for item in items:
        if item['code'] == code:
            found = True

    assert found


text:
<!DOCTYPE html>

    <title>substation:Action:Configuration#binaryStreams~summary documentation</title>
    <link rel="stylesheet" type="text/css" href="../../../../../../../../../../index.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../../../../../../highlight.css" />

            spare

                :substation:Action:Configuration#binaryStreams~summary

If true, accept unknown content types and pass them, as well as multipart/form-data requests,
to the Action as streams. The passed request.body will be a ReadableStream instance.

        This document was generated with
        doczar
        at 3:15pm on 8/11/2015


text:
package cn.ac.ict.htc.tools;

public final class Functions {
	public static final DoubleDoubleFunction PLUS = new DoubleDoubleFunction() {

		@Override
		public double apply(double a, double b) {
			return a + b;
		}
	};
}


text:
function getSupertabsApi() {
  var dispatcher = new MessageDispatcher("http://localhost:8999/w/api");
  var supertabs = new Supertabs();
  return new SupertabsApi(dispatcher, supertabs);
}

function SupertabsApi(dispatcher, supertabs) {
  this.dispatcher = dispatcher;
  this.supertabs = supertabs;
  this.credentials = null;

  self = this;
  this.masterCallback = function(xhr, msg) {
    var json_doc = JSON.parse(xhr.responseText);

    var response = null;
    try {
      response = json_doc.response;
    } catch(ex) {}

    var credentials = null;
    try {
      credentials = json_doc.credentials;

      if(credentials != null) {
        self.credentials = credentials;
      }
    } catch(ex) {}

    var error = null;
    try {
      error = json_doc.error;
    } catch(ex) {}

    if(typeof(msg.outer_callback) == "function")
      msg.outer_callback(response, credentials, error, msg);
  }

  this.getJsonifiable = function() {
    console.log(JSON.stringify(this.credentials));
    return { "supertabs": this.supertabs, "credentials": this.credentials };
  }

  this.login = function(username, password, callback) {
    var request = { "type" : "Login" };
    var credentials = { "type" : "UsernamePassword",
      "args" : {
        "username" : username,
        "password" : password
      }
    };

    var msg = { "request" : request, "credentials" : credentials };
    msg = new Message(msg, this.masterCallback, callback);
    this.dispatcher.sendMessage(msg);
  }

  this.logout = function(callback) {
    this.credentials = null;
    callback();
  }

  this.pull_all_tabs = function(callback) {
    var msg = { request : { type : "GetAllTabs" },
      credentials : this.credentials };
    msg = new Message(msg, this.masterCallback, callback);
    this.dispatcher.sendMessage(msg);
  }

  this.push_all_tabs = function(supertabs, callback) {
    var request = { type : "PushAllTabs", args : supertabs };
    var msg = { "request" : request, "credentials" : this.credentials };
    msg = new Message(msg, this.masterCallback, callback);
    this.dispatcher.sendMessage(msg);
  }

  this.update_tab = function(tab, callback) {
    if (! this.credentials) {
      return;
    }
    var request = { type : "UpdateTab", args : tab };
    var msg = { "request" : request, "credentials" : this.credentials };
    msg = new Message(msg, this.masterCallback, callback);
    this.dispatcher.sendMessage(msg);
  }

  this.deleted_tabs = new Array();
  this.last_deletion = 0;

  this.delete_tab = function(tab, callback) {
    var request = { type : "DeleteTab", args : tab };
    var msg = { "request" : request, "credentials" : this.credentials };
    msg = new Message(msg, this.masterCallback, callback);
    this.deleted_tabs.push(msg);
    var cur_time = new Date();
    this.last_deletion = cur_time.getTime();
    //this.dispatcher.sendMessage(msg);
  }

  this.flushDeletions = function() {
    var cur_time = new Date();
    if (cur_time.getTime() - this.last_deletion <= 500) {
      return;
    }
    var msg;
    while (this.deleted_tabs.length > 0) {
      msg = this.deleted_tabs.pop();
      console.log(msg);
      this.dispatcher.sendMessage(msg);
    }
    this.last_deletion = cur_time.getTime();
  }

  this.undelete = function() {
    this.deleted_tabs = new Array();
  }
}

function storeAllSupertabs(super_store) {
  var g = new Object()
  g.populate = true;

  chrome.windows.getAll(g,
      function(windows) {
        supertabs.supertabs = new Array();
        for(w = 0; w < windows.length; w++) {
          for(t = 0; t < windows[w].tabs.length; t++) {
            var tab = windows[w].tabs[t];
            supertabs.addTab(tab.windowId, tab.id, tab.index, tab.url);
          }
        }
      });
}

function flushDeletedTabs() {
  supertabs_api.flushDeletions();
  setTimeout("flushDeletedTabs();", 1000);
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1">
  <services>
    <service name="CiudadService">
      <implementation-class>Servicios.CiudadService</implementation-class>
    </service>
    <service name="DescuentoService">
      <implementation-class>Servicios.DescuentoService</implementation-class>
    </service>
    <service name="DetalleOfertaService">
      <implementation-class>Servicios.DetalleOfertaService</implementation-class>
    </service>
    <service name="ReporteService">
      <implementation-class>Servicios.ReporteService</implementation-class>
    </service>
    <service name="LocalService">
      <implementation-class>Servicios.LocalService</implementation-class>
    </service>
    <service name="UsuarioService">
      <implementation-class>Servicios.UsuarioService</implementation-class>
    </service>
    <service name="ValoracionService">
      <implementation-class>Servicios.ValoracionService</implementation-class>
    </service>
    <service name="CargarPuntosService">
      <implementation-class>Servicios.CargarPuntosService</implementation-class>
    </service>
    <service name="OfertaService">
      <implementation-class>Servicios.OfertaService</implementation-class>
    </service>
    <service name="OfertaVistaService">
      <implementation-class>Servicios.OfertaVistaService</implementation-class>
    </service>
    <service name="PuntosService">
      <implementation-class>Servicios.PuntosService</implementation-class>
    </service>
    <service name="RegionService">
      <implementation-class>Servicios.RegionService</implementation-class>
    </service>
    <service name="EmpresaService">
      <implementation-class>Servicios.EmpresaService</implementation-class>
    </service>
    <service name="OfertaLocalService">
      <implementation-class>Servicios.OfertaLocalService</implementation-class>
    </service>
    <service name="PersonaService">
      <implementation-class>Servicios.PersonaService</implementation-class>
    </service>
    <service name="ClienteService">
      <implementation-class>Servicios.ClienteService</implementation-class>
    </service>
    <service name="CategoriaService">
      <implementation-class>Servicios.CategoriaService</implementation-class>
    </service>
    <service name="CargoService">
      <implementation-class>Servicios.CargoService</implementation-class>
    </service>
    <service name="WebServiceAuthUser">
      <implementation-class>Servicios.WebServiceAuthUser</implementation-class>
    </service>
    <service name="ProductoService">
      <implementation-class>Servicios.ProductoService</implementation-class>
    </service>
    <service name="UsuarioOfertaService">
      <implementation-class>Servicios.UsuarioOfertaService</implementation-class>
    </service>
  </services>
  <clients/>
</jax-ws>


text:
#ifndef _NTSECPKG_H
#define _NTSECPKG_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif

#include "windef.h"
#include "ntsecapi.h"
#include "security.h"

#ifdef __cplusplus
extern "C" {
#endif

#define ISC_REQ_DELEGATE 1
#define ISC_REQ_MUTUAL_AUTH 2
#define ISC_REQ_REPLAY_DETECT 4
#define ISC_REQ_SEQUENCE_DETECT 8
#define ISC_REQ_CONFIDENTIALITY  16
#define ISC_REQ_USE_SESSION_KEY 32
#define ISC_REQ_PROMPT_FOR_CREDS 64
#define ISC_REQ_USE_SUPPLIED_CREDS  128
#define ISC_REQ_ALLOCATE_MEMORY 256
#define ISC_REQ_USE_DCE_STYLE 512
#define ISC_REQ_DATAGRAM 1024
#define ISC_REQ_CONNECTION 2048
#define ISC_REQ_EXTENDED_ERROR 16384
#define ISC_REQ_STREAM 32768
#define ISC_REQ_INTEGRITY 65536
#define ISC_REQ_MANUAL_CRED_VALIDATION 524288
#define ISC_REQ_HTTP  268435456

#define ISC_RET_EXTENDED_ERROR 16384

#define ASC_REQ_DELEGATE 1
#define ASC_REQ_MUTUAL_AUTH 2
#define ASC_REQ_REPLAY_DETECT 4
#define ASC_REQ_SEQUENCE_DETECT 8
#define ASC_REQ_CONFIDENTIALITY 16
#define ASC_REQ_USE_SESSION_KEY 32
#define ASC_REQ_ALLOCATE_MEMORY 256
#define ASC_REQ_USE_DCE_STYLE 512
#define ASC_REQ_DATAGRAM 1024
#define ASC_REQ_CONNECTION 2048
#define ASC_REQ_EXTENDED_ERROR 32768
#define ASC_REQ_STREAM 65536
#define ASC_REQ_INTEGRITY 131072

#define SECURITY_NATIVE_DREP  16
#define SECURITY_NETWORK_DREP 0

#define SECPKG_STATE_ENCRYPTION_PERMITTED               0x01
#define SECPKG_STATE_STRONG_ENCRYPTION_PERMITTED        0x02
#define SECPKG_STATE_DOMAIN_CONTROLLER                  0x04
#define SECPKG_STATE_WORKSTATION                        0x08
#define SECPKG_STATE_STANDALONE                         0x10

/* enum definitions for Secure Service Provider/Authentication Packages */
typedef enum _LSA_TOKEN_INFORMATION_TYPE {
	LsaTokenInformationNull,
	LsaTokenInformationV1
} LSA_TOKEN_INFORMATION_TYPE, *PLSA_TOKEN_INFORMATION_TYPE;
typedef enum _SECPKG_EXTENDED_INFORMATION_CLASS
{
	SecpkgGssInfo = 1,
	SecpkgContextThunks,
	SecpkgMutualAuthLevel,
	SecpkgMaxInfo
} SECPKG_EXTENDED_INFORMATION_CLASS;
typedef enum _SECPKG_NAME_TYPE {
	SecNameSamCompatible,
	SecNameAlternateId,
	SecNameFlat,
	SecNameDN
} SECPKG_NAME_TYPE;

/* struct definitions for SSP/AP */
typedef struct _SECPKG_PRIMARY_CRED {
	LUID LogonId;
	UNICODE_STRING DownlevelName;
	UNICODE_STRING DomainName;
	UNICODE_STRING Password;
	UNICODE_STRING OldPassword;
	PSID UserSid;
	ULONG Flags;
	UNICODE_STRING DnsDomainName;
	UNICODE_STRING Upn;
	UNICODE_STRING LogonServer;
	UNICODE_STRING Spare1;
	UNICODE_STRING Spare2;
	UNICODE_STRING Spare3;
	UNICODE_STRING Spare4;
} SECPKG_PRIMARY_CRED, *PSECPKG_PRIMARY_CRED;
typedef struct _SECPKG_SUPPLEMENTAL_CRED {
	UNICODE_STRING PackageName;
	ULONG CredentialSize;
	PUCHAR Credentials;
} SECPKG_SUPPLEMENTAL_CRED, *PSECPKG_SUPPLEMENTAL_CRED;
typedef struct _SECPKG_SUPPLEMENTAL_CRED_ARRAY {
	ULONG CredentialCount;
	SECPKG_SUPPLEMENTAL_CRED Credentials[1];
} SECPKG_SUPPLEMENTAL_CRED_ARRAY, *PSECPKG_SUPPLEMENTAL_CRED_ARRAY;
typedef struct _SECPKG_PARAMETERS {
	ULONG Version;
	ULONG MachineState;
	ULONG SetupMode;
	PSID DomainSid;
	UNICODE_STRING DomainName;
	UNICODE_STRING DnsDomainName;
	GUID DomainGuid;
} SECPKG_PARAMETERS, *PSECPKG_PARAMETERS,
  SECPKG_EVENT_DOMAIN_CHANGE, *PSECPKG_EVENT_DOMAIN_CHANGE;
typedef struct _SECPKG_CLIENT_INFO {
  LUID LogonId;
  ULONG ProcessID;
  ULONG ThreadID;
  BOOLEAN HasTcbPrivilege;
  BOOLEAN Impersonating;
  BOOLEAN Restricted;
} SECPKG_CLIENT_INFO,
 *PSECPKG_CLIENT_INFO;
typedef struct _SECURITY_USER_DATA {
	SECURITY_STRING UserName;
	SECURITY_STRING LogonDomainName;
	SECURITY_STRING LogonServer;
	PSID pSid;
} SECURITY_USER_DATA, *PSECURITY_USER_DATA,
  SecurityUserData, *PSecurityUserData;
typedef struct _SECPKG_GSS_INFO {
	ULONG EncodedIdLength;
	UCHAR EncodedId[4];
} SECPKG_GSS_INFO, *PSECPKG_GSS_INFO;
typedef struct _SECPKG_CONTEXT_THUNKS {
	ULONG InfoLevelCount;
	ULONG Levels[1];
} SECPKG_CONTEXT_THUNKS, *PSECPKG_CONTEXT_THUNKS;
typedef struct _SECPKG_MUTUAL_AUTH_LEVEL {
	ULONG MutualAuthLevel;
} SECPKG_MUTUAL_AUTH_LEVEL, *PSECPKG_MUTUAL_AUTH_LEVEL;
typedef struct _SECPKG_CALL_INFO {
	ULONG ProcessId;
	ULONG ThreadId;
	ULONG Attributes;
	ULONG CallCount;
} SECPKG_CALL_INFO, *PSECPKG_CALL_INFO;
typedef struct _SECPKG_EXTENDED_INFORMATION {
	SECPKG_EXTENDED_INFORMATION_CLASS Class;
	union {
		SECPKG_GSS_INFO GssInfo;
		SECPKG_CONTEXT_THUNKS ContextThunks;
		SECPKG_MUTUAL_AUTH_LEVEL MutualAuthLevel;
	} Info;
} SECPKG_EXTENDED_INFORMATION, *PSECPKG_EXTENDED_INFORMATION;

/* callbacks implemented by SSP/AP dlls and called by the LSA */
typedef VOID (NTAPI *PLSA_CALLBACK_FUNCTION)(ULONG_PTR, ULONG_PTR, PSecBuffer,
 PSecBuffer);

/* misc typedefs used in the below prototypes */
typedef PVOID *PLSA_CLIENT_REQUEST;
typedef ULONG LSA_SEC_HANDLE, *PLSA_SEC_HANDLE;
typedef LPTHREAD_START_ROUTINE SEC_THREAD_START;
typedef PSECURITY_ATTRIBUTES SEC_ATTRS;

/* functions used by SSP/AP obtainable by dispatch tables */
typedef NTSTATUS (NTAPI *PLSA_REGISTER_CALLBACK)(ULONG, PLSA_CALLBACK_FUNCTION);
typedef NTSTATUS (NTAPI *PLSA_CREATE_LOGON_SESSION)(PLUID);
typedef NTSTATUS (NTAPI *PLSA_DELETE_LOGON_SESSION)(PLUID);
typedef NTSTATUS (NTAPI *PLSA_ADD_CREDENTIAL)(PLUID, ULONG, PLSA_STRING,
 PLSA_STRING);
typedef NTSTATUS (NTAPI *PLSA_GET_CREDENTIALS)(PLUID, ULONG, PULONG, BOOLEAN,
 PLSA_STRING, PULONG, PLSA_STRING);
typedef NTSTATUS (NTAPI *PLSA_DELETE_CREDENTIAL)(PLUID, ULONG, PLSA_STRING);
typedef PVOID (NTAPI *PLSA_ALLOCATE_LSA_HEAP)(ULONG);
typedef VOID (NTAPI *PLSA_FREE_LSA_HEAP)(PVOID);
typedef NTSTATUS (NTAPI *PLSA_ALLOCATE_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST,
 ULONG, PVOID*);
typedef NTSTATUS (NTAPI *PLSA_FREE_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST, PVOID);
typedef NTSTATUS (NTAPI *PLSA_COPY_TO_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST, ULONG,
 PVOID, PVOID);
typedef NTSTATUS (NTAPI *PLSA_COPY_FROM_CLIENT_BUFFER)(PLSA_CLIENT_REQUEST,
 ULONG, PVOID, PVOID);
typedef NTSTATUS (NTAPI *PLSA_IMPERSONATE_CLIENT)(void);
typedef NTSTATUS (NTAPI *PLSA_UNLOAD_PACKAGE)(void);
typedef NTSTATUS (NTAPI *PLSA_DUPLICATE_HANDLE)(HANDLE, PHANDLE);
typedef NTSTATUS (NTAPI *PLSA_SAVE_SUPPLEMENTAL_CREDENTIALS)(PLUID, ULONG,
 PVOID, BOOLEAN);
typedef HANDLE (NTAPI *PLSA_CREATE_THREAD)(SEC_ATTRS, ULONG, SEC_THREAD_START,
 PVOID, ULONG, PULONG);
typedef NTSTATUS (NTAPI *PLSA_GET_CLIENT_INFO)(PSECPKG_CLIENT_INFO);
typedef HANDLE (NTAPI *PLSA_REGISTER_NOTIFICATION)(SEC_THREAD_START, PVOID,
 ULONG, ULONG, ULONG, ULONG, HANDLE);
typedef NTSTATUS (NTAPI *PLSA_CANCEL_NOTIFICATION)(HANDLE);
typedef NTSTATUS (NTAPI *PLSA_MAP_BUFFER)(PSecBuffer, PSecBuffer);
typedef NTSTATUS (NTAPI *PLSA_CREATE_TOKEN)(PLUID, PTOKEN_SOURCE,
 SECURITY_LOGON_TYPE, SECURITY_IMPERSONATION_LEVEL, LSA_TOKEN_INFORMATION_TYPE,
 PVOID, PTOKEN_GROUPS, PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING,
 PUNICODE_STRING, PHANDLE, PNTSTATUS);
typedef VOID (NTAPI *PLSA_AUDIT_LOGON)(NTSTATUS, NTSTATUS, PUNICODE_STRING,
 PUNICODE_STRING, PUNICODE_STRING, OPTIONAL PSID, SECURITY_LOGON_TYPE,
 PTOKEN_SOURCE, PLUID);
typedef NTSTATUS (NTAPI *PLSA_CALL_PACKAGE)(PUNICODE_STRING, PVOID, ULONG,
 PVOID*, PULONG, PNTSTATUS);
typedef VOID (NTAPI *PLSA_FREE_LSA_HEAP)(PVOID);
typedef BOOLEAN (NTAPI *PLSA_GET_CALL_INFO)(PSECPKG_CALL_INFO);
typedef NTSTATUS (NTAPI *PLSA_CALL_PACKAGEEX)(PUNICODE_STRING, PVOID, PVOID,
 ULONG, PVOID*, PULONG, PNTSTATUS);
typedef PVOID (NTAPI *PLSA_CREATE_SHARED_MEMORY)(ULONG, ULONG);
typedef PVOID (NTAPI *PLSA_ALLOCATE_SHARED_MEMORY)(PVOID, ULONG);
typedef VOID (NTAPI *PLSA_FREE_SHARED_MEMORY)(PVOID, PVOID);
typedef BOOLEAN (NTAPI *PLSA_DELETE_SHARED_MEMORY)(PVOID);
typedef NTSTATUS (NTAPI *PLSA_OPEN_SAM_USER)(PSECURITY_STRING, SECPKG_NAME_TYPE,
 PSECURITY_STRING, BOOLEAN, ULONG, PVOID*);
typedef NTSTATUS (NTAPI *PLSA_GET_USER_CREDENTIALS)(PVOID, PVOID *, PULONG,
 PVOID *, PULONG);
typedef NTSTATUS (NTAPI *PLSA_GET_USER_AUTH_DATA)(PVOID, PUCHAR *, PULONG);
typedef NTSTATUS (NTAPI *PLSA_CLOSE_SAM_USER)(PVOID);
typedef NTSTATUS (NTAPI *PLSA_CONVERT_AUTH_DATA_TO_TOKEN)(PVOID, ULONG,
 SECURITY_IMPERSONATION_LEVEL, PTOKEN_SOURCE, SECURITY_LOGON_TYPE,
 PUNICODE_STRING, PHANDLE, PLUID, PUNICODE_STRING, PNTSTATUS);
typedef NTSTATUS (NTAPI *PLSA_CLIENT_CALLBACK)(PCHAR, ULONG_PTR, ULONG_PTR,
 PSecBuffer, PSecBuffer);
typedef NTSTATUS (NTAPI *PLSA_UPDATE_PRIMARY_CREDENTIALS)(PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY);
typedef NTSTATUS (NTAPI *PLSA_GET_AUTH_DATA_FOR_USER)(PSECURITY_STRING,
 SECPKG_NAME_TYPE, PSECURITY_STRING, PUCHAR *, PULONG, PUNICODE_STRING);
typedef NTSTATUS (NTAPI *PLSA_CRACK_SINGLE_NAME)(ULONG, BOOLEAN,
 PUNICODE_STRING, PUNICODE_STRING, ULONG, PUNICODE_STRING, PUNICODE_STRING,
 PULONG);
typedef NTSTATUS (NTAPI *PLSA_AUDIT_ACCOUNT_LOGON)(ULONG, BOOLEAN,
 PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING, NTSTATUS);
typedef NTSTATUS (NTAPI *PLSA_CALL_PACKAGE_PASSTHROUGH)(PUNICODE_STRING, PVOID,
 PVOID, ULONG, PVOID*, PULONG, PNTSTATUS);

/* Dispatch tables of functions used by SSP/AP */
typedef struct SECPKG_DLL_FUNCTIONS {
	PLSA_ALLOCATE_LSA_HEAP AllocateHeap;
	PLSA_FREE_LSA_HEAP FreeHeap;
	PLSA_REGISTER_CALLBACK RegisterCallback;
} SECPKG_DLL_FUNCTIONS,
 *PSECPKG_DLL_FUNCTIONS;
typedef struct LSA_DISPATCH_TABLE {
	PLSA_CREATE_LOGON_SESSION CreateLogonSession;
	PLSA_DELETE_LOGON_SESSION DeleteLogonSession;
	PLSA_ADD_CREDENTIAL AddCredential;
	PLSA_GET_CREDENTIALS GetCredentials;
	PLSA_DELETE_CREDENTIAL DeleteCredential;
	PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap;
	PLSA_FREE_LSA_HEAP FreeLsaHeap;
	PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer;
	PLSA_FREE_CLIENT_BUFFER FreeClientBuffer;
	PLSA_COPY_TO_CLIENT_BUFFER CopyToClientBuffer;
	PLSA_COPY_FROM_CLIENT_BUFFER CopyFromClientBuffer;
} LSA_DISPATCH_TABLE,
 *PLSA_DISPATCH_TABLE;
typedef struct _LSA_SECPKG_FUNCTION_TABLE {
	PLSA_CREATE_LOGON_SESSION CreateLogonSession;
	PLSA_DELETE_LOGON_SESSION DeleteLogonSession;
	PLSA_ADD_CREDENTIAL AddCredential;
	PLSA_GET_CREDENTIALS GetCredentials;
	PLSA_DELETE_CREDENTIAL DeleteCredential;
	PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap;
	PLSA_FREE_LSA_HEAP FreeLsaHeap;
	PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer;
	PLSA_FREE_CLIENT_BUFFER FreeClientBuffer;
	PLSA_COPY_TO_CLIENT_BUFFER CopyToClientBuffer;
	PLSA_COPY_FROM_CLIENT_BUFFER CopyFromClientBuffer;
	PLSA_IMPERSONATE_CLIENT ImpersonateClient;
	PLSA_UNLOAD_PACKAGE UnloadPackage;
	PLSA_DUPLICATE_HANDLE DuplicateHandle;
	PLSA_SAVE_SUPPLEMENTAL_CREDENTIALS SaveSupplementalCredentials;
	PLSA_CREATE_THREAD CreateThread;
	PLSA_GET_CLIENT_INFO GetClientInfo;
	PLSA_REGISTER_NOTIFICATION RegisterNotification;
	PLSA_CANCEL_NOTIFICATION CancelNotification;
	PLSA_MAP_BUFFER MapBuffer;
	PLSA_CREATE_TOKEN CreateToken;
	PLSA_AUDIT_LOGON AuditLogon;
	PLSA_CALL_PACKAGE CallPackage;
	PLSA_FREE_LSA_HEAP FreeReturnBuffer;
	PLSA_GET_CALL_INFO GetCallInfo;
	PLSA_CALL_PACKAGEEX CallPackageEx;
	PLSA_CREATE_SHARED_MEMORY CreateSharedMemory;
	PLSA_ALLOCATE_SHARED_MEMORY AllocateSharedMemory;
	PLSA_FREE_SHARED_MEMORY FreeSharedMemory;
	PLSA_DELETE_SHARED_MEMORY DeleteSharedMemory;
	PLSA_OPEN_SAM_USER OpenSamUser;
	PLSA_GET_USER_CREDENTIALS GetUserCredentials;
	PLSA_GET_USER_AUTH_DATA GetUserAuthData;
	PLSA_CLOSE_SAM_USER CloseSamUser;
	PLSA_CONVERT_AUTH_DATA_TO_TOKEN ConvertAuthDataToToken;
	PLSA_CLIENT_CALLBACK ClientCallback;
	PLSA_UPDATE_PRIMARY_CREDENTIALS UpdateCredentials;
	PLSA_GET_AUTH_DATA_FOR_USER GetAuthDataForUser;
	PLSA_CRACK_SINGLE_NAME CrackSingleName;
	PLSA_AUDIT_ACCOUNT_LOGON AuditAccountLogon;
	PLSA_CALL_PACKAGE_PASSTHROUGH CallPackagePassthrough;
} LSA_SECPKG_FUNCTION_TABLE,
 *PLSA_SECPKG_FUNCTION_TABLE;

/* functions implemented by SSP/AP obtainable by dispatch tables */
typedef NTSTATUS (NTAPI *PLSA_AP_INITIALIZE_PACKAGE)(ULONG, PLSA_DISPATCH_TABLE,
 PLSA_STRING, PLSA_STRING, PLSA_STRING *);
typedef NTSTATUS (NTAPI *PLSA_AP_LOGON_USER)(LPWSTR, LPWSTR, LPWSTR, LPWSTR,
 DWORD, DWORD, PHANDLE);
typedef NTSTATUS (NTAPI *PLSA_AP_CALL_PACKAGE)(PUNICODE_STRING, PVOID, ULONG,
 PVOID *, PULONG, PNTSTATUS);
typedef VOID (NTAPI *PLSA_AP_LOGON_TERMINATED)(PLUID);
typedef NTSTATUS (NTAPI *PLSA_AP_CALL_PACKAGE_UNTRUSTED)(PLSA_CLIENT_REQUEST,
 PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS);
typedef NTSTATUS (NTAPI *PLSA_AP_CALL_PACKAGE_PASSTHROUGH)(PUNICODE_STRING,
 PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS);
typedef NTSTATUS (NTAPI *PLSA_AP_LOGON_USER_EX)(PLSA_CLIENT_REQUEST,
 SECURITY_LOGON_TYPE, PVOID, PVOID, ULONG, PVOID *, PULONG, PLUID, PNTSTATUS,
 PLSA_TOKEN_INFORMATION_TYPE, PVOID *, PUNICODE_STRING *, PUNICODE_STRING *,
 PUNICODE_STRING *);
typedef NTSTATUS (NTAPI *PLSA_AP_LOGON_USER_EX2)(PLSA_CLIENT_REQUEST,
 SECURITY_LOGON_TYPE, PVOID, PVOID, ULONG, PVOID *, PULONG, PLUID, PNTSTATUS,
 PLSA_TOKEN_INFORMATION_TYPE, PVOID *, PUNICODE_STRING *, PUNICODE_STRING *,
 PUNICODE_STRING *, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY *);
typedef NTSTATUS (SpInitializeFn)(ULONG_PTR, PSECPKG_PARAMETERS,
 PLSA_SECPKG_FUNCTION_TABLE);
typedef NTSTATUS (NTAPI SpShutDownFn)(void);
typedef NTSTATUS (NTAPI SpGetInfoFn)(PSecPkgInfoW);
typedef NTSTATUS (NTAPI SpAcceptCredentialsFn)(SECURITY_LOGON_TYPE,
 PUNICODE_STRING, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED);
typedef NTSTATUS (NTAPI SpAcquireCredentialsHandleFn)(PUNICODE_STRING, ULONG,
 PLUID, PVOID, PVOID, PVOID, PLSA_SEC_HANDLE, PTimeStamp);
typedef NTSTATUS (NTAPI SpQueryCredentialsAttributesFn)(LSA_SEC_HANDLE, ULONG,
 PVOID);
typedef NTSTATUS (NTAPI SpFreeCredentialsHandleFn)(LSA_SEC_HANDLE);
typedef NTSTATUS (NTAPI SpSaveCredentialsFn)(LSA_SEC_HANDLE, PSecBuffer);
typedef NTSTATUS (NTAPI SpGetCredentialsFn)(LSA_SEC_HANDLE, PSecBuffer);
typedef NTSTATUS (NTAPI SpDeleteCredentialsFn)(LSA_SEC_HANDLE, PSecBuffer);
typedef NTSTATUS (NTAPI SpInitLsaModeContextFn)(LSA_SEC_HANDLE, LSA_SEC_HANDLE,
 PUNICODE_STRING, ULONG, ULONG, PSecBufferDesc, PLSA_SEC_HANDLE, PSecBufferDesc,
 PULONG, PTimeStamp, PBOOLEAN, PSecBuffer);
typedef NTSTATUS (NTAPI SpAcceptLsaModeContextFn)(LSA_SEC_HANDLE,
 LSA_SEC_HANDLE, PSecBufferDesc, ULONG, ULONG, PLSA_SEC_HANDLE, PSecBufferDesc,
 PULONG, PTimeStamp, PBOOLEAN, PSecBuffer);
typedef NTSTATUS (NTAPI SpDeleteContextFn)(LSA_SEC_HANDLE);
typedef NTSTATUS (NTAPI SpApplyControlTokenFn)(LSA_SEC_HANDLE, PSecBufferDesc);
typedef NTSTATUS (NTAPI SpGetUserInfoFn)(PLUID, ULONG, PSecurityUserData *);
typedef NTSTATUS (NTAPI SpGetExtendedInformationFn)(
 SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION *);
typedef NTSTATUS (NTAPI SpQueryContextAttributesFn)(LSA_SEC_HANDLE, ULONG,
 PVOID);
typedef NTSTATUS (NTAPI SpAddCredentialsFn)(LSA_SEC_HANDLE, PUNICODE_STRING,
 PUNICODE_STRING, ULONG, PVOID, PVOID, PVOID, PTimeStamp);
typedef NTSTATUS (NTAPI SpSetExtendedInformationFn)(
 SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION);
typedef NTSTATUS (NTAPI SpInstanceInitFn)(ULONG, PSECPKG_DLL_FUNCTIONS,
 PVOID *);
typedef NTSTATUS (NTAPI SpInitUserModeContextFn)(LSA_SEC_HANDLE, PSecBuffer);
typedef NTSTATUS (NTAPI SpMakeSignatureFn)(LSA_SEC_HANDLE, ULONG,
 PSecBufferDesc, ULONG);
typedef NTSTATUS (NTAPI SpVerifySignatureFn)(LSA_SEC_HANDLE, PSecBufferDesc,
 ULONG, PULONG);
typedef NTSTATUS (NTAPI SpSealMessageFn)(LSA_SEC_HANDLE, ULONG, PSecBufferDesc,
 ULONG);
typedef NTSTATUS (NTAPI SpUnsealMessageFn)(LSA_SEC_HANDLE, PSecBufferDesc,
 ULONG, PULONG);
typedef NTSTATUS (NTAPI SpGetContextTokenFn)(LSA_SEC_HANDLE, PHANDLE);
typedef NTSTATUS (NTAPI SpCompleteAuthTokenFn)(LSA_SEC_HANDLE, PSecBufferDesc);
typedef NTSTATUS (NTAPI SpFormatCredentialsFn)(PSecBuffer, PSecBuffer);
typedef NTSTATUS (NTAPI SpMarshallSupplementalCredsFn)(ULONG, PUCHAR, PULONG,
 PVOID *);
typedef NTSTATUS (NTAPI SpExportSecurityContextFn)(LSA_SEC_HANDLE, ULONG,
 PSecBuffer, PHANDLE);
typedef NTSTATUS (NTAPI SpImportSecurityContextFn)(PSecBuffer, HANDLE,
 PLSA_SEC_HANDLE);

/* Dispatch tables of functions implemented by SSP/AP */
typedef struct SECPKG_FUNCTION_TABLE {
	PLSA_AP_INITIALIZE_PACKAGE InitializePackage;
	PLSA_AP_LOGON_USER LogonUser;
	PLSA_AP_CALL_PACKAGE CallPackage;
	PLSA_AP_LOGON_TERMINATED LogonTerminated;
	PLSA_AP_CALL_PACKAGE_UNTRUSTED CallPackageUntrusted;
	PLSA_AP_CALL_PACKAGE_PASSTHROUGH CallPackagePassthrough;
	PLSA_AP_LOGON_USER_EX LogonUserEx;
	PLSA_AP_LOGON_USER_EX2 LogonUserEx2;
	SpInitializeFn *Initialize;
	SpShutDownFn *Shutdown;
	SpGetInfoFn *GetInfo;
	SpAcceptCredentialsFn *AcceptCredentials;
	SpAcquireCredentialsHandleFn *AcquireCredentialsHandle;
	SpQueryCredentialsAttributesFn *QueryCredentialsAttributes;
	SpFreeCredentialsHandleFn *FreeCredentialsHandle;
	SpSaveCredentialsFn *SaveCredentials;
	SpGetCredentialsFn *GetCredentials;
	SpDeleteCredentialsFn *DeleteCredentials;
	SpInitLsaModeContextFn *InitLsaModeContext;
	SpAcceptLsaModeContextFn *AcceptLsaModeContext;
	SpDeleteContextFn *DeleteContext;
	SpApplyControlTokenFn *ApplyControlToken;
	SpGetUserInfoFn *GetUserInfo;
	SpGetExtendedInformationFn *GetExtendedInformation;
	SpQueryContextAttributesFn *QueryContextAttributes;
	SpAddCredentialsFn *AddCredentials;
	SpSetExtendedInformationFn *SetExtendedInformation;
} SECPKG_FUNCTION_TABLE,
 *PSECPKG_FUNCTION_TABLE;

typedef struct SECPKG_USER_FUNCTION_TABLE {
	SpInstanceInitFn *InstanceInit;
	SpInitUserModeContextFn *InitUserModeContext;
	SpMakeSignatureFn *MakeSignature;
	SpVerifySignatureFn *VerifySignature;
	SpSealMessageFn *SealMessage;
	SpUnsealMessageFn *UnsealMessage;
	SpGetContextTokenFn *GetContextToken;
	SpQueryContextAttributesFn *QueryContextAttributes;
	SpCompleteAuthTokenFn *CompleteAuthToken;
	SpDeleteContextFn *DeleteUserModeContext;
	SpFormatCredentialsFn *FormatCredentials;
	SpMarshallSupplementalCredsFn *MarshallSupplementalCreds;
	SpExportSecurityContextFn *ExportContext;
	SpImportSecurityContextFn *ImportContext;
} SECPKG_USER_FUNCTION_TABLE,
 *PSECPKG_USER_FUNCTION_TABLE;

/* Entry points to SSP/AP */
typedef NTSTATUS (NTAPI *SpLsaModeInitializeFn)(ULONG, PULONG,
 PSECPKG_FUNCTION_TABLE *, PULONG);
typedef NTSTATUS (WINAPI *SpUserModeInitializeFn)(ULONG, PULONG,
 PSECPKG_USER_FUNCTION_TABLE *, PULONG);

#ifdef __cplusplus
}
#endif
#endif /* _NTSECPKG_H */


text:
package org.appng.api.model;

import java.util.Locale;

/**
 * Basic account data.
 *
 * @author Matthias Müller
 */
public interface Account {

	/**
	 * Returns the username of this {@link Account}, e.g. 'admin'.
	 *
	 * @return the username
	 */
	String getAuthName();

	/**
	 * Returns the real name of this {@link Account}, e.g. 'appNG Administrator'.
	 *
	 * @return the real name
	 */
	String getRealname();

	/**
	 * Returns the language tag for this {@link Account} in the IETF BCP
	 * 47 notation: {@code <lang>-<country>}.

	 * Examples:
	 *

	 *
en
	 *
en-US
	 *
de
	 *
de-CH
	 *

	 *
	 * @return the language
	 *
	 * @see Locale#forLanguageTag(String)
	 */
	String getLanguage();

	/**
	 * Returns the timezone for this {@link Account}, e.g. 'Europe/Berlin'.
	 *
	 * @return the timezone
	 */
	String getTimeZone();

	/**
	 * Returns the email for this {@link Account}, e.g. 'admin@example.com'.
	 *
	 * @return the email
	 */
	String getEmail();

}


text:
 package com.indeed.flamdex.simple;

import com.indeed.util.io.Files;
import com.indeed.flamdex.utils.FlamdexUtils;
import com.indeed.flamdex.writer.IntFieldWriter;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * @author jsgroth
 */
final class SimpleIntFieldWriter extends SimpleFieldWriter implements IntFieldWriter {
    private final String outputDirectory;
    private final String field;
    private final boolean writeBTreesOnClose;

    private long lastTermWritten = 0L;
    private boolean hasCurrentTerm = false;
    private long currentTerm;

    private SimpleIntFieldWriter(String outputDirectory, String field, boolean writeBTreesOnClose, OutputStream termsOutput, OutputStream docsOutput, long numDocs) {
        super(termsOutput, docsOutput, numDocs);
        this.outputDirectory = outputDirectory;
        this.field = field;
        this.writeBTreesOnClose = writeBTreesOnClose;
    }

    public static String getTermsFilename(String field) {
        return "fld-"+field+".intterms";
    }

    public static String getDocsFilename(String field) {
        return "fld-"+field+".intdocs";
    }

    public static SimpleIntFieldWriter open(String outputDirectory, String field, long numDocs, boolean writeBTreesOnClose) throws FileNotFoundException {
        final OutputStream termsOutput = new BufferedOutputStream(new FileOutputStream(Files.buildPath(outputDirectory, getTermsFilename(field))), 65536);
        final OutputStream docsOutput = new BufferedOutputStream(new FileOutputStream(Files.buildPath(outputDirectory, getDocsFilename(field))), 65536);
        return new SimpleIntFieldWriter(outputDirectory, field, writeBTreesOnClose, termsOutput, docsOutput, numDocs);
    }

    /**
     * switch terms
     *
     * @param term the term to switch to
     * @throws IOException if there is a file write error
     * @throws IllegalArgumentException if term is negative or if term is less than or equal to the previous term added
     */
    @Override
    public void nextTerm(long term) throws IOException {
        if (hasCurrentTerm && term <= currentTerm) throw new IllegalArgumentException("terms must be in sorted order: "+term+" is not greater than "+currentTerm);

        internalNextTerm();
        hasCurrentTerm = true;
        currentTerm = term;
    }

    @Override
    protected void writeTermDelta() throws IOException {
        final long termDelta = currentTerm - lastTermWritten;
        FlamdexUtils.writeVLong(termDelta, termsOutput);
        lastTermWritten = currentTerm;
    }

    @Override
    protected void writeBTreeIndex() throws IOException {
        if (writeBTreesOnClose) {
            SimpleFlamdexWriter.writeIntBTree(outputDirectory, field, new File(outputDirectory, "fld-" + field + ".intindex64"));
        }
    }
}


text:
//
//  CJImageAddDeletePickUploadCollectionView.m
//  CJUIKitDemo
//
//  Created by ciyouzen on 2017/9/11.
//  Copyright © 2017年 dvlproad. All rights reserved.
//

#import "CJImageAddDeletePickUploadCollectionView.h"
#import <Masonry/Masonry.h>
#import <MediaPlayer/MediaPlayer.h>
#import <CJBaseHelper/UIViewControllerCJHelper.h>
#import "CJImageAddUploadProgressView.h"
#import "CJMediaBrowserUtil.h"
#import "CJChooseFileActionSheetUtil.h"

@interface CJImageAddDeletePickUploadCollectionView () <UICollectionViewDelegate> {

}

@end

@implementation CJImageAddDeletePickUploadCollectionView

/*
 *  初始化方法
 *
 *  @return 图片 添加+删除+选择+删除+上传 集合视图
 */
- (instancetype)init {
    self = [super initWithConfigItemCellBlock:^(CQActionImageCollectionViewCell *bItemCell, id bDataModel) {
        UIImage *dataModel = (UIImage *)bDataModel;
        //dataModel.indexPath = indexPath;
        bItemCell.image = dataModel;

        [self __operateDataCell:bItemCell withDataModel:bDataModel];

    } clickItemHandle:^(NSArray *bDataModels, NSInteger currentClickItemIndex) {
        [self __clickDataModelAtItemIndex:currentClickItemIndex
                             inDataModels:bDataModels];
    } addHandle:^(CQActionImageCollectionView *bCollectionView) {
        //NSLog(@"点击额外的item");
//        if (self.mediaType == CJMediaTypeVideo) { //视频选择
//            if (pickVideoHandle) {
//                pickVideoHandle();
//            } else {
//                NSLog(@"未操作视频选择");
//            }
//        } else { // 图片选择
            [self __pickImageWithCompleteBlock:nil];
//        }

    } otherItemCellDeleteBlock:^(id bDataModel) {
        CJImageUploadFileModelsOwner *dataModel = (CJImageUploadFileModelsOwner *)bDataModel;
        if (dataModel.operation) { //如果有请求任务,则还应该取消掉该任务
            [dataModel.operation cancel];
        }
    }];

    return self;
}

#pragma mark - Private Method
/*
 *  设置或者更新Cell
 *
 *  @param cell             要设置或者更新的Cell
 *  @param dataModel        用来设置cell的dataModel
 */
- (void)__operateDataCell:(CQActionImageCollectionViewCell *)dataCell
            withDataModel:(CJImageUploadFileModelsOwner *)dataModel
{
    // cell 的删除操作
    __weak typeof(self)weakCollectionView = self;

    // 完善cell这个view的上传请求
    if (self.uploadActionType == CJUploadActionTypeNone) {
        return;
    }

    CJImageAddUploadProgressView *uploadProgressView = [[CJImageAddUploadProgressView alloc] init];
    [dataCell addSubview:uploadProgressView];
    [uploadProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(dataCell);
    }];

    CJUploadMomentInfo *momentInfo = dataModel.momentInfo;
    [uploadProgressView updateProgressText:momentInfo.uploadStatePromptText progressVaule:momentInfo.progressValue];//调用此方法避免reload时候显示错误

    void (^uploadInfoChangeBlock)(CJUploadFileModelsOwner *itemThatSaveUploadInfo) = ^(CJUploadFileModelsOwner *itemThatSaveUploadInfo) {
        CJImageUploadFileModelsOwner *imageItem = (CJImageUploadFileModelsOwner *)itemThatSaveUploadInfo;
        //CQActionImageCollectionViewCell *myCell = (CQActionImageCollectionViewCell *)[weakCollectionView cellForItemAtIndexPath:imageItem.indexPath];
        CJUploadMomentInfo *momentInfo = itemThatSaveUploadInfo.momentInfo;
        [uploadProgressView updateProgressText:momentInfo.uploadStatePromptText progressVaule:momentInfo.progressValue];
    };

    NSArray<CJUploadFileModel *> *uploadModels = dataModel.uploadFileModels;

    CJUploadFileModelsOwner *saveUploadInfoToItem = dataModel;

    /*
    NSURLSessionDataTask *(^createDetailedUploadRequestBlock)(void) = ^(void){
        NSURLSessionDataTask *operation =
        [IjinbuNetworkClient detailedRequestUploadItems:uploadModels
                                                toWhere:0
                                andsaveUploadInfoToItem:saveUploadInfoToItem
                                  uploadInfoChangeBlock:uploadInfoChangeBlock];

        return operation;
    };
    */

    NSURLSessionDataTask *operation = saveUploadInfoToItem.operation;
    if (operation == nil) {
        //operation = createDetailedUploadRequestBlock();
        operation = self.createDetailedUploadRequestBlock(uploadModels, saveUploadInfoToItem, uploadInfoChangeBlock);

        saveUploadInfoToItem.operation = operation;
    }

    //cjReUploadHandle
    __weak typeof(saveUploadInfoToItem)weakItem = saveUploadInfoToItem;
    [uploadProgressView setCjReUploadHandle:^(UIView *uploadProgressView) {
        __strong __typeof(weakItem)strongItem = weakItem;

        [strongItem.operation cancel];

        NSURLSessionDataTask *newOperation = nil;
        //newOperation = createDetailedUploadRequestBlock();
        newOperation = self.createDetailedUploadRequestBlock(uploadModels, saveUploadInfoToItem, uploadInfoChangeBlock);

        strongItem.operation = newOperation;
    }];
}

- (BOOL)isAllUploadFinish {
//    for (CJUploadFileModelsOwner *uploadItem in self.cjDataSource.dataModels) {
//        CJUploadMomentInfo *momentInfo = uploadItem.momentInfo;
//        if (momentInfo.uploadState == CJUploadMomentStateFailure) {
//            NSLog(@"Failure:请等待所有附件上传完成");
//            return NO;
//        }
//    }
    return YES;
}

/// 查看已添加的图片或者视频
- (void)__clickDataModelAtItemIndex:(NSInteger)itemIndex
                       inDataModels:(NSArray *)dataModels
{
    CJUploadFileModelsOwner *baseUploadItem = [dataModels objectAtIndex:itemIndex];

    CJUploadMomentInfo *momentInfo = baseUploadItem.momentInfo;
    if (momentInfo.uploadState == CJUploadMomentStateFailure) {
        return;
    }

    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];

//    if (self.mediaType == CJMediaTypeVideo) {
//        CJImageUploadFileModelsOwner *imageUploadItem = [dataModels objectAtIndex:itemIndex];
//        [CJMediaBrowserUtil browseVideoWithLocalRelativePath:imageUploadItem.localRelativePath];
//    } else {
//
//    }
}

/// 选择照片
- (void)__pickImageWithCompleteBlock:(void(^)(void))pickImageCompleteBlock {
    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];

    __weak typeof(self)weakSelf = self;
    NSInteger canMaxChooseImageCount = self.currentCanMaxAddCount;

    [CJChooseFileActionSheetUtil defaultImageChooseWithCanMaxChooseImageCount:canMaxChooseImageCount pickCompleteBlock:^(NSArray<UIImage *> *bImages) {
        [weakSelf addImageModels:bImages];

        if (pickImageCompleteBlock) {
            pickImageCompleteBlock();
        }
    }];
}

@end


text:
import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled, { keyframes } from 'styled-components';
import { pxToRem } from '@strapi/helper-plugin';
import Clock from '@strapi/icons/Clock';
import Refresh from '@strapi/icons/Refresh';
import { Link } from '@strapi/design-system/v2/Link';
import { Box } from '@strapi/design-system/Box';
import { Stack } from '@strapi/design-system/Stack';
import { Flex } from '@strapi/design-system/Flex';
import { Typography } from '@strapi/design-system/Typography';
import { Content, IconBox, Overlay } from './Overlay';

const overlayContainer = document.createElement('div');
const ID = 'autoReloadOverlayBlocker';
overlayContainer.setAttribute('id', ID);

const rotation = keyframes`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(359deg);
  }
`;

const LoaderReload = styled(Refresh)`
  animation: ${rotation} 1s infinite linear;
`;

const Blocker = ({ displayedIcon, description, title, isOpen }) => {
  const { formatMessage } = useIntl();

  useEffect(() => {
    document.body.appendChild(overlayContainer);

    return () => {
      document.body.removeChild(overlayContainer);
    };
  }, []);

  if (isOpen) {
    return ReactDOM.createPortal(
      <Overlay>
        <Content spacing={6}>
          <Stack spacing={2}>
            <Flex justifyContent="center">
              <Typography as="h1" variant="alpha">
                {formatMessage(title)}
              </Typography>
            </Flex>
            <Flex justifyContent="center">
              <Typography as="h2" textColor="neutral600" fontSize={4} fontWeight="regular">
                {formatMessage(description)}
              </Typography>
            </Flex>
          </Stack>
          <Flex justifyContent="center">
            {displayedIcon === 'reload' && (
              <IconBox padding={6} background="primary100" borderColor="primary200">
                <LoaderReload width={pxToRem(36)} height={pxToRem(36)} />
              </IconBox>
            )}

            {displayedIcon === 'time' && (
              <IconBox padding={6} background="primary100" borderColor="primary200">
                <Clock width={pxToRem(40)} height={pxToRem(40)} />
              </IconBox>
            )}
          </Flex>
          <Flex justifyContent="center">
            <Box paddingTop={2}>
              <Link href="https://docs.strapi.io" isExternal>
                {formatMessage({
                  id: 'global.documentation',
                  defaultMessage: 'Read the documentation',
                })}
              </Link>
            </Box>
          </Flex>
        </Content>
      </Overlay>,
      overlayContainer
    );
  }

  return null;
};

Blocker.propTypes = {
  displayedIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.array]).isRequired,
  description: PropTypes.object.isRequired,
  isOpen: PropTypes.bool.isRequired,
  title: PropTypes.object.isRequired,
};

export default Blocker;


text:
#import "TWTRVideoControlsViewSynchronizer.h"
#import <TwitterCore/TWTRAssertionMacros.h>
#import "TWTRStringUtil.h"
#import "TWTRVideoControlsView.h"
#import "TWTRVideoPlaybackState.h"

/**
 * This object provides a mechanism for breaking the retain cycle
 * that occurs when using a display link. Instead of requiring the
 * users of the TWTRVideoControlsViewSynchronizer to invalidate the
 * display link we can hide it in the implementation details.
 */
@interface TWTRSynchronizerDisplayLinkWrapper : NSObject

@property (nonatomic, readonly) CADisplayLink *displayLink;
@property (nonatomic, copy) dispatch_block_t actionBlock;

@end

@implementation TWTRSynchronizerDisplayLinkWrapper

- (instancetype)init
{
    self = [super init];
    if (self) {
        _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkDidFire:)];
        _displayLink.frameInterval = 20;
        [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
    }
    return self;
}

- (void)displayLinkDidFire:(CADisplayLink *)link
{
    if (self.actionBlock) {
        self.actionBlock();
    }
}

- (void)invalidate
{
    [self.displayLink invalidate];
    _displayLink = nil;
}

@end

@interface TWTRVideoControlsViewSynchronizer ()

@property (nonatomic, readonly) TWTRSynchronizerDisplayLinkWrapper *displayLinkWrapper;

/**
 * A mechanism to remember what the playback state was when we started scubbing so we can return to that value.
 */
@property (nonatomic) TWTRVideoPlaybackState playbackStateBeforeScrubbing;

@end

@implementation TWTRVideoControlsViewSynchronizer {
    BOOL _disableSynchronization;
}

- (instancetype)initWithVideoPlayer:(TWTRVideoPlayerOutputView *)player controls:(TWTRVideoControlsView *)controls
{
    TWTRParameterAssertOrReturnValue(player, nil);
    TWTRParameterAssertOrReturnValue(controls, nil);

    self = [super init];
    if (self) {
        _videoPlayerView = player;
        _controlsView = controls;

        self.presentsVideoControlsOnReady = YES;

        _displayLinkWrapper = [[TWTRSynchronizerDisplayLinkWrapper alloc] init];
        _displayLinkWrapper.actionBlock = [self displayLinkDidFireBlock];

        _videoPlayerView.delegate = self;
        _controlsView.delegate = self;

        [self synchronizeUI];
    }
    return self;
}

- (void)dealloc
{
    [_displayLinkWrapper invalidate];
}

- (void)setPresentsVideoControlsOnReady:(BOOL)presentsVideoControlsOnReady
{
    if (_presentsVideoControlsOnReady != presentsVideoControlsOnReady) {
        self.controlsView.alpha = presentsVideoControlsOnReady ? 0.0 : 1.0;
        _presentsVideoControlsOnReady = presentsVideoControlsOnReady;
    }
}

- (void)setControlsView:(TWTRVideoControlsView * _Nullable)controlsView
{
    _controlsView = controlsView;
    _controlsView.delegate = self;
    [self synchronizeUI];
}

- (dispatch_block_t)displayLinkDidFireBlock
{
    @weakify(self) return ^{
        @strongify(self) if (self->_disableSynchronization || !self.videoPlayerView || !self.controlsView)
        {
            return;  // no need to update
        }
        [self synchronizeUI];
    };
}

- (void)synchronizeUI
{
    NSTimeInterval elapsed;
    NSTimeInterval duration;

    if (self.videoPlayerView) {
        elapsed = [self.videoPlayerView elapsedTime];
        duration = [self.videoPlayerView videoDuration];
    } else {
        elapsed = -1;
        duration = -1;
    }

    [self updateTimeLabelWithElapsedTime:elapsed duration:duration];
    [self.controlsView updateScrubberWithValue:elapsed / duration];
}

- (void)updateTimeLabelWithElapsedTime:(NSTimeInterval)elapsed duration:(NSTimeInterval)duration
{
    [self.controlsView updateWithElapsedTime:elapsed duration:duration];
}

- (void)handleActionButton
{
    [self.videoPlayerView proceedToNextPlaybackState];
}

#pragma mark - Controls View Delegate

- (void)videoControlsView:(TWTRVideoControlsView *)controlsView didTapControlButton:(UIButton *)controlButton
{
    [self.videoPlayerView proceedToNextPlaybackState];
}

- (void)videoControlsView:(TWTRVideoControlsView *)controlsView scrubberDidTouchDown:(UISlider *)scrubber
{
    _disableSynchronization = YES;
    self.playbackStateBeforeScrubbing = self.videoPlayerView.playbackState;
    [self.videoPlayerView pause];
}

- (void)videoControlsView:(TWTRVideoControlsView *)controlsView scrubberDidTouchUp:(UISlider *)scrubber
{
    _disableSynchronization = NO;
    if (self.playbackStateBeforeScrubbing == TWTRVideoPlaybackStatePlaying) {
        [self.videoPlayerView play];
    }
}

- (void)videoControlsView:(TWTRVideoControlsView *)controlsView scrubberDidChangeValue:(UISlider *)scrubber
{
    NSTimeInterval duration = self.videoPlayerView.videoDuration;
    NSTimeInterval position = scrubber.value * duration;
    [self.videoPlayerView seekToPosition:position];
    [self updateTimeLabelWithElapsedTime:position duration:duration];
}

- (void)videoControlsView:(TWTRVideoControlsView *)controlsView didTapFullscreenButton:(UIButton *)fullscreenButton
{
    if ([self.delegate respondsToSelector:@selector(controlsViewSynchronizerDidTapFullscreen:)]) {
        [self.delegate controlsViewSynchronizerDidTapFullscreen:self];
    }
}

#pragma mark - Video Player Delegate

- (void)videoPlayer:(TWTRVideoPlayerOutputView *)player didChangePlaybackState:(TWTRVideoPlaybackState)newState;
{
    [self.controlsView updateForControlState:newState];

    if ([self.delegate respondsToSelector:@selector(controlsViewSynchronizer:didChangePlaybackState:)]) {
        [self.delegate controlsViewSynchronizer:self didChangePlaybackState:newState];
    }

}

- (void)videoPlayerDidBecomeReady:(TWTRVideoPlayerOutputView *)player
{
    if (!self.presentsVideoControlsOnReady) {
        return;
    }

    if ([self.delegate respondsToSelector:@selector(controlsViewSynchronizerVideoPlayerDidBecomeReady:)]) {
        [self.delegate controlsViewSynchronizerVideoPlayerDidBecomeReady:self];
    }

    [UIView animateWithDuration:0.3
                     animations:^{
                         self.controlsView.alpha = 1.0;
                     }];
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>establishment</type>
  <type>local_government_office</type>
  <type>point_of_interest</type>
  <formatted_address>Yenişehir Mahallesi, Demokrasi Cd. No:72, 41050 İzmit/Kocaeli, Turkey</formatted_address>
  <address_component>
   <long_name>72</long_name>
   <short_name>72</short_name>
   <type>street_number</type>
  </address_component>
  <address_component>
   <long_name>Demokrasi Caddesi</long_name>
   <short_name>Demokrasi Cd.</short_name>
   <type>route</type>
  </address_component>
  <address_component>
   <long_name>Yenişehir Mahallesi</long_name>
   <short_name>Yenişehir Mahallesi</short_name>
   <type>administrative_area_level_4</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>İzmit</long_name>
   <short_name>İzmit</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Kocaeli</long_name>
   <short_name>Kocaeli</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Turkey</long_name>
   <short_name>TR</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>41050</long_name>
   <short_name>41050</short_name>
   <type>postal_code</type>
  </address_component>
  <geometry>
   <location>
    <lat>40.7634938</lat>
    <lng>29.9625334</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>40.7621448</lat>
     <lng>29.9611844</lng>
    </southwest>
    <northeast>
     <lat>40.7648428</lat>
     <lng>29.9638824</lng>
    </northeast>
   </viewport>
  </geometry>
  <place_id>ChIJa79Qf_BPyxQRHGc8P3GnFV8</place_id>
 </result>
</GeocodeResponse>