以下均“剽窃”自我的偶像猫哥的博客,仅用做笔记

1.ACE5.7.8在vs2010正式版下不可用

不解释了,下面的转的一段话说得比较清楚了。
It says that you can #define errno WSAGetLastError() and has the following example:
r = recv(...);
if (r == -1 /* (but see below) */
&& WSAGetLastError() == EWOULDBLOCK)
{...}
This code will NOT work in VS2010 because EWOULDBLOCK is 140 and WSAEWOULDBLOCK is 10035L.
Some popular libraries like openssl are now broken because of this.

 

 

==============================================================================

 

 

2.ACE下关于异步handler_pool的问题,见代码。

#pragma once
#include <ace/Asynch_IO.h>
#include <ace/Proactor.h>

class Fast_Asynch_Read_Stream : public ACE_Asynch_Read_Stream
{
public:
 Fast_Asynch_Read_Stream (void)
 {
 }

 /// Destructor.
 virtual ~Fast_Asynch_Read_Stream (void)
 {
 }

 int open (ACE_Handler &handler,
  ACE_HANDLE handle = ACE_INVALID_HANDLE,
  const void *completion_key = 0,
  ACE_Proactor *proactor = 0)
 {
  if(implementation_==NULL)
  {

   proactor = this->get_proactor (proactor, handler);
   if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0)
    return -1;
  }

  // Call the <open> method of the base class.
  return ACE_Asynch_Operation::open (handler,
   handle,
   completion_key,
   proactor);
 }
};

class Fast_Asynch_Write_Stream : public ACE_Asynch_Write_Stream
{
public:

 Fast_Asynch_Write_Stream (void){}

 virtual ~Fast_Asynch_Write_Stream (void){}

 int open (ACE_Handler &handler,
  ACE_HANDLE handle = ACE_INVALID_HANDLE,
  const void *completion_key = 0,
  ACE_Proactor *proactor = 0)
 {
  if(implementation_==NULL)
  {

   proactor = this->get_proactor (proactor, handler);

   // Now let us get the implementation initialized.
   if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0)
    return -1;
  }
  // Call the <open> method of the base class.
  return ACE_Asynch_Operation::open (handler,
   handle,
   completion_key,
   proactor);
 }
};

红色部分为处理使用自定义实现handler_pool有可能导致的内存泄漏问题。

 

===================================================================================

 

3.网络编程常用设计模式

Abstract Factory [GoF95] provides an interface for creating families of related or dependent objects without specifying their concrete classes.

Abstract Manager [Lieb01] focuses on the management of business objects in enterprise systems.

Activator [Stal00] helps to implement efficient on-demand activation and deactivation of services that are accessed by multiple clients.

Active Object [POSA2] decouples method execution from method invocation.

Adapter [GoF95] converts the interface of a class into an interface expected by clients. Adapter allows classes to work together that could not do so otherwise because of incompatible interfaces.

Asynchronous Completion Token [POSA2] allows an application efficiently to demultiplex and process the responses of asynchronous operations it invokes on services.

Cache Management [Gran98] focuses on caching objects in Java and on how to combine a cache with the Manager [Somm98] pattern.

Cache Proxy [POSA1] implements caching inside a proxy that represents the data source from which one or multiple clients want to retrieve data.

Comparand [CoHa01] provides a means of interpreting differing objects as being the same in specific contexts. It does this by introducing an instance variable, the comparand, in each class of interest, and using it for comparison. Establishing the ‘sameness’ of differing objects is necessary when more than one reference refers conceptually to the same object.

Component Configurator [POSA2] allows an application to link and unlink its component implementations at run-time without having to modify, recompile, or statically relink the application.

Command Processor [POSA1] separates the request for a service from its execution. A command processor component manages requests as separate objects, schedules their execution, and provides additional services such as storing request objects for later undo.

Data Transfer Object [Fowl02] carries data, for example other objects or invocation parameters, between remote clients and servers. The encapsulation provided by this pattern reduces the number of remote operations required to transfer such data.

Deployer [Stal00] describes how to configure, deploy, and install software artifacts.

Disposal Method [Henn03] encapsulates the concrete details of object disposal by providing an explicit method for cleaning up objects, instead of abandoning the objects to be garbage collected or terminating them by deletion.

Double-Checked Locking Optimization [POSA2] reduces contention and synchronization overheads when critical sections of code must acquire locks in a thread-safe manner just once during program execution.

Factory Method [GoF95] defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

Fixed Allocation [NoWe00] allows memory consumption to be predicted by allocating the necessary memory at program initialization.

Flyweight [GoF95] uses sharing to support large numbers of fine-grained objects efficiently.

Half-Object Plus Protocol [Mesz95] divides the responsibilities of an object into halves and assigns them to two interdependent half-objects when an object is used by two distributed clients. For efficiency reasons, each half-object implements the responsibility that is most used locally. This pattern lets the half-objects coordinate themselves via some protocol.

Interceptor [POSA2] allows services to be added to a framework transparently and triggered automatically when specific events occur.

Lazy Load [Fowl02] defers the loading of data from databases until it is first accessed.

Lazy Optimization [Auer96] optimizes the performance of a piece of software only after the design has been correctly determined.

Lazy Propagator [FeTi97] describes how, in a network of dependent objects, objects can determine when they are affected by the state changes of other objects, and therefore need to update their state.

Lazy State [MoOh97] defers the initialization of the state of an object [GoF95] until the state is accessed.

Manager [Somm98] places functionality that applies to all objects of a class into a separate management object. This separation allows the independent variation of management functionality and its reuse for different object classes.

Master-Slave [POSA1] supports fault tolerance, parallel computation and computational accuracy. A master component distributes work to identical slave components and computes a final result from the results returned by the slaves.

Mediator [GoF95] defines an object that encapsulates the way in which a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and allows their interaction to be varied independently.

Memento [GoF95] encapsulates the state of an object in a separate, persistable object.

Model-View-Controller [POSA1] divides an interactive application into three components. The model contains the core functionality and data, the view displays information to the user, and the controller handles user input. The view and controller together comprise the user interface. A change-propagation mechanism ensures consistency between the user interface and the model.

Object Lifetime Manager [LGS01] is specialized for the management of singleton objects in operating systems that do not support static destructors properly, such as real-time operating systems.

Object Pool [Gran98] manages the reuse of objects of a type that is expensive to create, or of which only a limited number can be created.

Page Cache [TMQH+03] improves response times when dynamically-generated Web pages are accessed. A page cache is associated with a Web server that uses it to store accessed pages indexed by their URLs. When the same URL is requested, the Web server queries the cache and returns the cached page instead of dynamically generating its contents again.

Passivation [VSW02] persists and activates memory representations of component instances to and from persistent storage.

Pooled Allocation [NoWe00] pre-allocates a pool of memory blocks, recycling them when returned.

Proxy [GoF95] provides a surrogate or placeholder for another object, to control access to it.

Proactive Resource Allocation [Cros02] anticipates system changes and plans necessary resource allocations ahead of time, with the goal of maintaining system performance even under changed conditions.

Reactor [POSA2] allows event-driven applications to demultiplex and dispatch service requests that are delivered to an application from one or more clients.

Reflection [POSA1] provides a mechanism for changing the structure and behavior of software systems dynamically. A meta level provides information about selected system properties and makes the software self-aware.

Resource Exchanger [SaCa96] reduces a server's load when allocating and using resources by sharing common buffers that are passed between clients and servers.

Singleton [GoF95] ensures a class has only one instance, and provides a global point of access to it.

Sponsor-Selector [Wall97] separates three fundamentally different responsibilities: recommending a resource, selecting among resources, and using a resource.

State [GoF95] allows an object to alter its behavior when its internal state changes.

Strategy [GoF95] encapsulates logic, such as algorithms, into interchangeable classes that are independent of client requests.

Thread-local Memory Pool [Somm02] allows a memory allocator to be created for each thread. This helps to reduce synchronization overheads, since dynamic memory allocations are performed from a thread-local pool of pre-allocated memory.

Thread Pooling [PeSo97] describes how to bound the number of threads used and how to reuse unused threads.

Variable Allocation [NoWe00] optimizes memory consumption by performing memory allocations on demand.

Virtual Proxy [GoF95] loads or constructs the object that the proxy represents on demand.

Wrapper Facade [POSA2] encapsulates the functions and data provided by existing non-object-oriented APIs within more concise, robust, portable, maintainable, and cohesive object-oriented class interfaces.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目标检测(Object Detection)是计算机视觉领域的一个核心问题,其主要任务是找出图像中所有感兴趣的目标(物体),并确定它们的类别和位置。以下是对目标检测的详细阐述: 一、基本概念 目标检测的任务是解决“在哪里?是什么?”的问题,即定位出图像中目标的位置并识别出目标的类别。由于各类物体具有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具挑战性的任务之一。 二、核心问题 目标检测涉及以下几个核心问题: 分类问题:判断图像中的目标属于哪个类别。 定位问题:确定目标在图像中的具体位置。 大小问题:目标可能具有不同的大小。 形状问题:目标可能具有不同的形状。 三、算法分类 基于深度学习的目标检测算法主要分为两大类: Two-stage算法:先进行区域生成(Region Proposal),生成有可能包含待检物体的预选框(Region Proposal),再通过卷积神经网络进行样本分类。常见的Two-stage算法包括R-CNN、Fast R-CNN、Faster R-CNN等。 One-stage算法:不用生成区域提议,直接在网络中提取特征来预测物体分类和位置。常见的One-stage算法包括YOLO系列(YOLOv1、YOLOv2、YOLOv3、YOLOv4、YOLOv5等)、SSD和RetinaNet等。 四、算法原理 以YOLO系列为例,YOLO将目标检测视为回归问题,将输入图像一次性划分为多个区域,直接在输出层预测边界框和类别概率。YOLO采用卷积网络来提取特征,使用全连接层来得到预测值。其网络结构通常包含多个卷积层和全连接层,通过卷积层提取图像特征,通过全连接层输出预测结果。 五、应用领域 目标检测技术已经广泛应用于各个领域,为人们的生活带来了极大的便利。以下是一些主要的应用领域: 安全监控:在商场、银行
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值