handler

Event Handlers and Listeners & Event Bubbling and Event Capturing

最后都变了- 提交于 2019-12-30 07:31:55
问题 I am confused with "Event Listener", "Event Handler", "Event Bubbling" and "Event Capturing" in JavaScript. I have search in internet and have looked into different website but, I still have problem understanding some differences and even the basic condition. As this article suggests, the event handler is created and listens for an event. Does it mean that, the JavaScript functions attached to the elements inside the DOM are not event handler and they are event listener? Also, here I found

004——Netty之高性能IO(Reactor)

不打扰是莪最后的温柔 提交于 2019-12-30 00:47:36
一、原始方式 方法一: # 使用while循环,不断监听端口是否有新的套接字链接 while(true){ socket = accept(); handle(socket) } # 做法局限:处理效率低下,并发是请求只能阻塞 方法二: # 一个连接对应一个线程 while(true){ socket = accept(); new thread(socket); } # 每个线程阻塞不会影响到后续请求,但对资源要求非常高。线程粒度大,每个线程一次性处理所有交互事情(连接、读取和写入),限制了吞吐量。 方法三: # 将线程粒度减小。将一次连接的操作划分为更细的粒度或者过程。这样虽然线程数量变多,但是处理的事情更为简单和单一 二、Reactor定义 关键点 事件驱动(event handling) 可以处理一个或多个输入源(one or more inputs) 通过Service Handler同步的将输入事件(Event)采用多路复用分发给对应Handler处理 处理流程 同步的等待多个事件源到达(采用select()实现) 将事件多路分解以及分配相应的事件服务进行处理,这个分派采用server集中处理(dispatch) 分解的事件以及对应的事件服务应用从分派服务中分离出去(handler) 使用Reactor的原因 NIO的优点 : 基于事件驱动

关于PHP的错误设置

可紊 提交于 2019-12-29 22:34:23
  在php.ini文件中,和错误有关的设置有如下几个:   (1)error_reporting,设定错误级别   (2)display_errors,是否显示错误报告,设置为ON则打开,设置为OFF则关闭所有错误提示   (3)log_errors,默认设置为OFF,是否记录错误日志;   (4)track_errors,默认设置为OFF,该选项可以帮助解决代码中的错误,而不是让PHP提供其默认的功能。   当log_errors为On时会记录PHP运行时产生的错误到文件,同时要指定error_log="/usr/local/php/var/log/php_error.log",如果没指定或者指定的文件没有权限写入,那么照样会输出到正常的输出渠道,那么也就使得display_errors这个指定的Off失效。如果设置了set_error_handler 或set_exception_handler也会影响到错误日志写入到文件(其实这两个方法捕捉到的错误信息就不会写入到文件了,如set_error_handler是捕捉Notice类错误信息,set_exception_handler是捕捉 Fatal error类错误,如果只设置了set_error_handler没有设置set_exception_handler,那么日志里只记录Fatal error类错误,如果只设置了set

dubbo源码解析(服务暴露+服务引用)

余生颓废 提交于 2019-12-29 18:57:44
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、服务暴露 1.xml解析 <dubbo:service> 标签会被解析成 ServiceBean,ServiceBean 实现了 InitializingBean,所以在类加载完成之后会调用 afterPropertiesSet() 方法。暴露就是从这里开始的。 public void onApplicationEvent(ApplicationEvent event) { if (ContextRefreshedEvent.class.getName().equals(event.getClass().getName())) { if (isDelay() && ! isExported() && ! isUnexported()) { if (logger.isInfoEnabled()) { logger.info("The service ready on spring started. service: " + getInterface()); } export(); } } } 2.开始暴露 org.apache.dubbo.config.ServiceConfig#doExportUrls开始 多协议暴露 org.apache.dubbo.config.ServiceConfig

SpringBoot实现多环境配置

与世无争的帅哥 提交于 2019-12-29 14:12:15
1.为什么需要配置多环境配置 在实际的开发中,我们往往需要在不同的环境中使用不同的数据库、缓存配置,如果使用同一套配置文件,在不同环境部署的时候手动去修改配置文件,会使部署变得很繁琐。使用多环境配置文件可以很方便的实现此功能。 1.创建不同环境的配置文件 在resource文件夹中添加一下配置文件: application-dev.properties //开发环境配置文件 application-rc.properties //线上环境配置文件 application-test.properties //测试环境配置文件 2. 选择使用的配置文件 在resource/application.properties配置文件中添加一下配置项目: spring.profiles.active=dev 此配置用于选择使用的配置环境,值为application-{profile}.properties中的profile值。 3.使用命令行选择使用的配置文件 SpringBoot还支持通过命令行的方式修改配置,使用方式如下: java -jar xxx.jar --spring.profiles.active=dev 其中--spring.profiles.active=dev相当于在application.properties文件中加入了此配置。 4.测试多环境配置 我们分别在

Event对象跨浏览器兼容性写法

拟墨画扇 提交于 2019-12-29 13:37:45
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Event对象跨浏览器兼容性写法</title> </head> <body> <script> var EventUtil={ //添加事件 addHandler:function(element,type,handler){ if (element.addEventListener){ element.addEventListener(type,handler,false); }else if(element.attachEvent){ element.attachEvent("on"+type,handler); }else{ element["on"+type]=handler; } }, //移除事件 removeHandler:function (element,type,handler){ if (element.removeEventListener){ element

Interaction between JQuery validation and form submit handler: Broken, or am I doing something wrong?

杀马特。学长 韩版系。学妹 提交于 2019-12-29 09:16:16
问题 Some of my forms require validation, for which I use the JQuery validation plug-in. Some of my forms require a custom submit handler (which conditionally pops-up a confirmation dialog before submitting, independent of validation). I attach the handler to the form like so: function confirmHandlerAttach(form, handler) { $(form).off("submit", confirmHandlerDefault); $(form).on("submit", handler); } Both validation and the submit handler are attached at doc ready based on classes. Independently,

Spring MVC流程及使用

蹲街弑〆低调 提交于 2019-12-28 12:03:38
一、SpringMVC 简单介绍 SpringMVC 框架是以请求为驱动,围绕 Servlet 设计,将请求发给控制器,然后通过模型对象,分派器来展示请求结果视图。其中核心类是 DispatcherServlet,它是一个 Servlet,顶层是实现的Servlet接口。 二、 SpringMVC 使用 需要在 web.xml 中配置 DispatcherServlet 。并且需要配置 Spring 监听器ContextLoaderListener ```xml <listener> <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet </servlet-class> <!-- 如果不设置init-param标签,则必须在/WEB-INF/下创建xxx-servlet.xml文件,其中xxx是servlet-name中配置的名称。 --> <init-param> <param-name

Android, pausing and resuming handler callbacks

强颜欢笑 提交于 2019-12-28 04:08:48
问题 I have a handler that I am using as follows: handler.postDelayed(Play, 1000); when my application onPause() is called before this is done, I need to pause it and tell it not to perform the "postDelayed" until I resume. is this possible, or is there an alternative way? My problem is that when onPause() is called I pause the audio (SoundManager), but if this handler.postDelayed is called after that, the audio will not be paused and will continue to play with my application in the background.

SpringMVC源码(五)- doDispatch - getHandle的准备阶段(@RequestMapping解析注册)

妖精的绣舞 提交于 2019-12-28 02:26:36
目录 一、doDispatch的getHandler 1、RequestMappingHandlerMapping结构 2、setApplicationContext回调函数 3、afterPropertiesSet回调函数 1)、获取可能的类 2)、解析和注册 3)、递归查询所有的方法 4)、将RequestMapping注解修饰的方法以RequestMappingInfo返回 5)、注册调用方法 二、doDispatch的getHandlerAdapter 1、RequestMappingHandlerAdapter 2、HandlerFunctionAdapter 3、HttpRequestHandlerAdapter 4、SimpleControllerHandlerAdapter 5、SimpleServletHandlerAdapter 三、总结 一、doDispatch的getHandler SpringMVC中比较重要的就是doDispatch,而其中第一个比较重要的就是根据HttpServletRequest(当前为RequestFacade类型)获取HandlerExecutionChain(调用的Controller和需要调用的HandlerInterceptor链)。 @Nullable protected HandlerExecutionChain