spec相关知识
-
采坑指南——k8s域名解析coredns问题排查过程正文 前几天,在ucloud上搭建的k8s集群(搭建教程后续会发出)。今天发现域名解析不了。 组件版本:k8s 1.15.0,coredns:1.3.1 过程是这样的: 首先用以下yaml文件创建了一个nginx服务 apiVersion: v1 kind: Service metadata: name: nginx-svc-old labels: app: nginx-svc spec: selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80 --- apiVersion: apps/v1beta1 kind: Deployment metadata: name: nginx-old spec: replicas: 1 te
-
备战CKA每日一题——第2天 | Daemonset、对接存储CSI知识点本活动在微信公众号【我的小碗汤】上举行,有送书活动!这里参与答题不能参与到送书活动哦! 接上一篇备战CKA每日一题——第1天 昨日考题 以下 Daemonset yaml 中,哪些是正确的?(多选) A. apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: default labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch template: metadata: labels: name: fluentd-elasticsearch spec: conta
-
说说如何使用 Activiti 创建并运行第一个流程1 第一个流程定义首先,我们定义一个只包含开始与结束节点的流程:流程定义描述文件:<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
-
ios学习笔记--git私有仓库的创建和使用一、CocoaPods私有库创建 这里提倡用Coding不仅仅是快,而且免费,GitHub私有库慢而且收费 一、创建私有Spec repo https://git.coding.net/ZKReadStone/ZKSpecs.git $ open ~/.cocoapods/repos //打开.cocoapods/repo文件夹 查看master文件夹结构如下图: 1.创建私有Spec repo远程仓库,如下图 二、创建项目仓库(https://git.coding.net/ZKReadStone/LoginModule.git)的时候只要填下图的几项 注意:下图这两项不要选,因为项目工程通过下面命令创建 pod lib create [项目名]
spec相关课程
spec相关教程
- 3.1 语法 adb logcat [<option>] ... [<filter-spec>] ...
- 1.2 SSL 协议结构 握手协议(SSL Handshake Protocol):它建立在 SSL 记录协议之上,用于在实际的数据传输开始前,通讯双方进行身份认证、协商加密算法、交换加密密钥等。内部包括SSL握手协议(SSL HandShake Protocol)、SSL密码参数修改协议(SSL Change Cipher Spec Protocol)和SSL告警协议(SSL Alert Protocol)。记录协议(SSL Record Protocol):它建立在可靠的传输协议(如TCP)之上,为高层协议提供数据封装、压缩、加密等基本功能的支持。
- 2. 定时器 定时器特别常用,前面提到的事件优化中的节流防抖,也有定时器参与。BOM 提供了两种定时器:window.setTimeout 在一定时间后做一些事情window.setInterval 每隔一段事件做一些事情定时器并不是精确的,会因为上下文环境的各种因素产生偏差。定时器的最小延迟事件是 4ms ,其在 HTML5 spec有被描述。现代浏览器为了优化后台性能损耗等,使在非当前 tab 的页面中的定时器的最小延迟在 1000ms 以上。
- 3. HttpUrlConnection 的使用步骤 首先还是引用一下 Google 官方的使用文档:A URLConnection with support for HTTP-specific features. See the spec for details.Uses of this class follow a pattern:Obtain a new HttpURLConnection by calling [URL#openConnection()](https://developer.android.com/reference/java/net/URL#openConnection()) and casting the result to HttpURLConnection.Prepare the request. The primary property of a request is its URI. Request headers may also include metadata such as credentials, preferred content types, and session cookies.Optionally upload a request body. Instances must be configured with [setDoOutput(true)](https://developer.android.com/reference/java/net/URLConnection#setDoOutput(boolean)) if they include a request body. Transmit data by writing to the stream returned by [URLConnection.getOutputStream()](https://developer.android.com/reference/java/net/URLConnection#getOutputStream()).Read the response. Response headers typically include metadata such as the response body’s content type and length, modified dates and session cookies. The response body may be read from the stream returned by [URLConnection.getInputStream()](https://developer.android.com/reference/java/net/URLConnection#getInputStream()). If the response has no body, that method returns an empty stream.Disconnect. Once the response body has been read, the HttpURLConnection should be closed by calling [disconnect()](https://developer.android.com/reference/java/net/HttpURLConnection#disconnect()). Disconnecting releases the resources held by a connection so they may be closed or reused.官方文档没有对 Http 协议本身做什么解释(如果对 Http 协议不太了解的同学,可以参考慕课网上网络相关课程),主要是围绕 HttpUrlConnection 的用法展开了一步步的描述,结合官网的解释以及我个人的总结,大体上可以分为一下几步:通过openConnection()方法创建一个HttpURLConnection:URL url = new URL(https://www.baidu.com);HttpURLConnection conn = (HttpURLConnection) url.openConnection();首先创建一个 URL 对象,参数就是我们要打开的地址,然后使用 url 对象的openConnection()来打开 Http 连接,拿到一个HttpURLConnection对象。2. 设置 Http 请求类型设置本次 Http 请求的方法类型,Http 有以下几种类型:GETPOSTHEADCONNECTOPTIONSTRACEPATCHPUT**DELETE这里就不做详细的解释了,可自行百度。最常用的就是前两种:GET和POST:conn.setRequestMethod("GET");设置 Http 相关参数这一步主要是设置请求头的参数,我们前面那张大表就可以派上用场了。此时可以设置 Cookie、Content-Type、超时时间等等参数。比如设置超时时间为 3 秒:conn.setConnectTimeout(3*1000); conn.setWirteTimeout(3 * 1000);获取输入流通过getInputStream()方法获取网络输入流,此后可以通过此对象获取网络数据,如下:InputStream in = conn.getInputStream();关闭流网络流比较消耗资源,在使用完毕之后一定要将 Http 连接关掉:conn.disconnect();
- 2.2 Django 中上传文件流程追踪 这部分内容会有点复杂和枯燥,我会尽量简化代码,并使用前面的上传实验帮助我们在源码中打印一些 print语句,辅助我们更好的理解整个上传过程。思考问题:为什么上传文件时,我们能通过 request.FILES['file'] 拿到文件?Django 帮我们把文件信息存到这里面,那么它是如何处理上传的文件的呢?我们现在的目的就是要搞清楚上面的问题,可能里面的代码会比较复杂,目前我们不深入研究代码细节,只是搞清楚整个过程以及 Django 帮我们做了哪些工作。首先,我们打印下视图函数的 request 参数,发现它是 django.core.handlers.wsgi.WSGIRequest 的一个实例,这在很早之前也是介绍过的。我们重点看看 WSGIRequest 类中的 FILES 属性:# 源码位置:django/core/handlers/wsgi.py# ...class WSGIRequest(HttpRequest): # ... @property def FILES(self): if not hasattr(self, '_files'): self._load_post_and_files() return self._files # ...看到这里,我们就大概知道 FILES 属性值的来源了,就是通过 self._load_post_and_files() 这个方法设置self._files 值,而这个就是 FILES 的值。接下来就是继续深入 self._load_post_and_files() 这个方法,但是我们不追究代码细节。# 源码位置:django/http/request.pyclass HttpRequest: """A basic HTTP request.""" # ... def _load_post_and_files(self): """Populate self._post and self._files if the content-type is a form type""" if self.method != 'POST': self._post, self._files = QueryDict(encoding=self._encoding), MultiValueDict() return if self._read_started and not hasattr(self, '_body'): self._mark_post_parse_error() return if self.content_type == 'multipart/form-data': if hasattr(self, '_body'): # Use already read data data = BytesIO(self._body) else: data = self try: self._post, self._files = self.parse_file_upload(self.META, data) except MultiPartParserError: # An error occurred while parsing POST data. Since when # formatting the error the request handler might access # self.POST, set self._post and self._file to prevent # attempts to parse POST data again. self._mark_post_parse_error() raise elif self.content_type == 'application/x-www-form-urlencoded': self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict() else: self._post, self._files = QueryDict(encoding=self._encoding), MultiValueDict() # ...一般而言,我们使用的是 form 表单提交的上传,对应的 content-type 大部分时候是 multipart/form-data。所以,获取 _files 属性的最重要的代码就是:self._post, self._files = self.parse_file_upload(self.META, data)咋继续追踪 self.parse_file_upload() 这个方法。class HttpRequest: """A basic HTTP request.""" # ... def _initialize_handlers(self): self._upload_handlers = [uploadhandler.load_handler(handler, self) for handler in settings.FILE_UPLOAD_HANDLERS] @property def upload_handlers(self): if not self._upload_handlers: # If there are no upload handlers defined, initialize them from settings. self._initialize_handlers() return self._upload_handlers @upload_handlers.setter def upload_handlers(self, upload_handlers): if hasattr(self, '_files'): raise AttributeError("You cannot set the upload handlers after the upload has been processed.") self._upload_handlers = upload_handlers def parse_file_upload(self, META, post_data): """Return a tuple of (POST QueryDict, FILES MultiValueDict).""" self.upload_handlers = ImmutableList( self.upload_handlers, warning="You cannot alter upload handlers after the upload has been processed." ) parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding) return parser.parse() # ...这三个涉及的函数都比较简单,主要是获取处理上传文件的 handlers。settings.FILE_UPLOAD_HANDLERS 这个值是取得 global_settings.py 中设置的,而非项目的 settings.py 文件(该文件默认没有设置该参数值)。但是我们可以在 settings.py 文件中设置 FILE_UPLOAD_HANDLERS 的值以覆盖默认的 handlers。# 源码位置:django\conf\global_settings.py# ...# List of upload handler classes to be applied in order.FILE_UPLOAD_HANDLERS = [ 'django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler',]# ...最后可以看到 parse_file_upload() 方法的核心语句也只有一句:parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)最后调用 parser.parse() 方法获得结果。最后要说明的是 parser.parse() 比较复杂,我们简单看下函数的大致内容即可,课后在继续深究函数的细节:# 源码位置:django/http/multipartparser.pyclass MultiPartParser: # ... def parse(self): """ Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict. Return a tuple containing the POST and FILES dictionary, respectively. """ from django.http import QueryDict encoding = self._encoding handlers = self._upload_handlers # HTTP spec says that Content-Length >= 0 is valid # handling content-length == 0 before continuing if self._content_length == 0: return QueryDict(encoding=self._encoding), MultiValueDict() # See if any of the handlers take care of the parsing. # This allows overriding everything if need be. for handler in handlers: result = handler.handle_raw_input( self._input_data, self._meta, self._content_length, self._boundary, encoding, ) # Check to see if it was handled if result is not None: return result[0], result[1] # Create the data structures to be used later. self._post = QueryDict(mutable=True) self._files = MultiValueDict() # Instantiate the parser and stream: stream = LazyStream(ChunkIter(self._input_data, self._chunk_size)) # Whether or not to signal a file-completion at the beginning of the loop. old_field_name = None counters = [0] * len(handlers) # Number of bytes that have been read. num_bytes_read = 0 # To count the number of keys in the request. num_post_keys = 0 # To limit the amount of data read from the request. read_size = None # ... # Signal that the upload has completed. # any() shortcircuits if a handler's upload_complete() returns a value. any(handler.upload_complete() for handler in handlers) self._post._mutable = False return self._post, self._files可以看到,这个函数最后得到 self._post, self._files, 然后返回该结果。有兴趣的话可以自行在这几个重要的地方加上 print() 方法看看对应的 self._post, self._files 的输出结果,有助于加深印象。
- 4-5 添加新角色(前端) 企业级在线办公系统
spec相关搜索
-
s line
safari浏览器
samba
SAMP
samplerate
sandbox
sanitize
saper
sas
sass
save
smarty模板
smil
smtp
snapshot
snd
snmptrap
soap
soapclient
soap协议