match

php curl封装类

元气小坏坏 提交于 2019-12-22 00:47:29
一个php curl封装的类,减少代码量,简化采集工作。这个类也是我工作的最常用的类之一。这里分享给大家。配合上phpquery,十分好用。 <?php namespace iphp\core; use iphp\App; /** * 封装了的curl http请求类 * @author xuen */ class MyCurl { public $ch; // 当前链接对象 public $str = ''; // 当前串 public $match; // 正则表达式 /** * 将curl常量属性转变成一个数组,便于使用 * @var string */ public $defaultOpt = array( CURLOPT_URL => '', // 请求的URL CURLOPT_RETURNTRANSFER => 1, // 设置有返回信息,以流的形式返回,非不是直接输出 CURLOPT_HTTPGET => 1, // 设定为GET请求。 // 定义默认的回调函数,这样exec()将在成功后返回1 CURLOPT_CONNECTTIMEOUT => 30, // 设置默认链接超时间为30秒 CURLOPT_TIMEOUT=>30,//设置下载时间最多30秒。 // 自动跟踪重定向。 CURLOPT_FOLLOWLOCATION => true, //

Juniper SRX NAT详解

浪尽此生 提交于 2019-12-22 00:00:21
第一部分:介绍Juniper SRX NAT 网络地址转换(NAT) 是用于修改或转换数据包包头中的网络地址信息的一种方法。可转换数据包中的源和/或目标地址。NAT 中可包含端口号及IP 地址的转换。 NAT类型: 1、source NAT: a、基于Interface的source NAT b、基于pool的source NAT 2、destination NAT 3、static NAT NAT规则: NAT 类型决定NAT 规则的处理顺序。流的第一个数据包处理期间,将按照以下顺序应用NAT 规则: 静态NAT 规则 目标NAT 规则 路由查找 安全策略查找 反向映射静态NAT 规则 源NAT 规则 下图显示NAT规则的处理顺序 NAT规则集: 在NAT中rule set决定所有流量的方向,而rule set里面又包含有多个rule。一旦rule set 发现到有匹配的流量后,rule set 里面每个rule都会开始进行匹配计算,之后rule会为匹配的流量指定动作;而在不同类型的NAT中,rule set能匹配的条件是不一样的 规则集为信息流指定一组常规匹配条件。对于静态NAT 和目标NAT,规则集指定以下项之一: 源接口 .源区段 .源路由实例 root@Juniper-vSRX# set security nat destination rule-set dst-nat

Get the index of the group that matched in a regexp?

不羁岁月 提交于 2019-12-21 22:28:59
问题 I have a regexp: /(alpha)|(beta)|(gamma)/gi Some text to match against: Betamax. Digamma. Alphabet. Hebetation. The matches are: beta, gamma, alpha, beta The values I am looking would be: 1,2,0,1 ...can I ascertain the index of the group that matched in the regexp? 回答1: To access the groups, you will need to use .exec() repeatedly: var regex = /(alpha)|(beta)|(gamma)/gi, str = "Betamax. Digamma. Alphabet. Hebetation."; for (var nums = [], match; match = regex.exec(str); ) nums.push(match

ScrollView垂直滚动控件和HorizontalScrollView水平滚动控件

亡梦爱人 提交于 2019-12-21 20:54:49
这个控件的特点就是里面只可以有一个控件,一般我们都是这样来做,外面放一个滚动条控件,里面放一个垂直的线性布局垂直摆放,然后在线性布局里添加控件 http://schemas.android.com/apk/res/android" xmlns:tools=" http://schemas.android.com/tools " android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none"> //把滚动条关闭 android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > 水平滚控件和垂直一样 如果想让两个嵌套也可以 来源: https://www.cnblogs.com/84126858jmz/p/4869647.html

2019 SDN上机第6次作业

爷,独闯天下 提交于 2019-12-21 20:07:14
2019 SDN上机第6次作业 1.实验拓扑 实验拓扑 见 2019 SDN上机第2次作业 要求 使用Python脚本完成拓扑搭建,并连接ryu控制器。 2.使用Ryu的REST API下发流表实现和第2次实验同样的VLAN 参考资料 REST API:可以在线学习中国大学MOOC 《软件定义网络》第六讲 北向接口 Ryu控制器的API文档:ryu.app.ofctl_rest Ryu的拓扑展示 助教博客:基于RYU restful api实现的VLAN网络虚拟化 要求 编写脚本,一键执行下发流表。 3.对比两种方法,写出你的实验体会 1.实验拓扑 python 脚本如下 from mininet.topo import Topo class MyTopo(Topo): def __init__(self): # initilaize topology Topo.__init__(self) # add hosts and switches h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') s1 = self.addSwitch('s1') s2

Javascript error: “val.match is not a function”

ぐ巨炮叔叔 提交于 2019-12-21 06:46:41
问题 I used the match function for regular expression. the code I use is if(val.match(/^s+$/) || val == "" ) but the javascript errors with "val.match is not function" I cant find what the problem is, thanks in advance 回答1: I would say that val is not a string. I get the "val.match is not function" error for the following var val=12; if(val.match(/^s+$/) || val == ""){ document.write("success: " + val); } The error goes away if you explicitly convert to a string String(val) var val=12; if(String

What's the shortest regex that can match non-zero floating point numbers with any number of decimal places?

ぃ、小莉子 提交于 2019-12-21 04:18:17
问题 What's the shortest regex that can match non-zero floating point numbers with any number of decimal places? It should accept numbers like -1 -5.9652 -7.00002 -0.8 -0.0500 -0.58000 0.01 0.000005 0.9900 5 7.5 7.005 but reject constructions such as . .02 -. -.996 0 -0 0. -0. -0.000 0.00 -- .. + +0 +1 +. +1.26 ,etc I do not need support for the scientific notation, with e , E and such. The language I'm using is C#, by the way. 回答1: ^-?(0\.\d*[1-9]|[1-9]\d*(\.\d+)?)$ EDIT Updated to reflect new

Game Center Finding a Match Programmatically

岁酱吖の 提交于 2019-12-21 03:38:14
问题 I just can't figure out how this works. What I am trying to do is let two players play a game if a third player joins it can instantly join the game, if the fourth and last player joins it can also instantly join the game. They can also leave the game at anytime for whatever reason, if that happens there should be a space open for another person or for the same person to reconnect. That's the idea. Now what I got is the following. I authenticate the local player for obvious reasons. Then I

上拉查看详情和下拉隐藏详情

我是研究僧i 提交于 2019-12-20 10:27:16
https://blog.csdn.net/liuzonrze/article/details/71409544 项目商品详情页的需求,实现上拉显示和下拉隐藏详情的功能,最终效果图如图: 实现思路:上下通过判断两个ScrollView的滑动位置及触摸事件发生的位置,对他们进行隐藏和显示。 上拉部分,由于内部包裹了大量带有点击事件的组件,故需要在上拉条上进行拖动,否则会冲突无法判断。这部分是通过对其包裹内容动态的调用layout方法来实现拖拽效果; 下拉部分,通过对下拉头动态设置marginTop的值,来改变其高度,并达到隐藏和显示的效果。 核心代码 //上拉组件 @Bind(R.id.xscrollview) XScrollView mXscrollview; @Bind(R.id.scrollContainer) LinearLayout scrollContainer; //下拉组件 @Bind(R.id.scrollContainer2) RelativeLayout scrollContainer2; @Bind(R.id.svBottomDetails) ScrollView svBottomDetails; @Bind({R.id.llDownScroll}) LinearLayout llDownScroll; //上拉部分 private Rect rect =

How do I return the row index of a sequence in R? [duplicate]

。_饼干妹妹 提交于 2019-12-20 07:07:49
问题 This question already has answers here : How to index a vector sequence within a vector sequence (5 answers) Closed 4 years ago . I'm trying to find the row positions of a sequence. By that I mean the following: x<-c(-1,1) y<-c(1,-1,1,0,-1,0,0) match(x,y) [1] 2 1 Why doesn't this return 2 3 ? (That's what I want it to do) If I do this: y<-c(0,-1,1,0,-1,0,0) match(x,y) [1] 2 3 it works. Advice? 回答1: Here's an idea. imatch() will find all the matched indices, in case there is more than one set