GVKun编程网logo

邀请收件人调查Monkey Collector API PHP(查收邀请函)

2

在本文中,您将会了解到关于邀请收件人调查MonkeyCollectorAPIPHP的新资讯,同时我们还将为您解释查收邀请函的相关在本文中,我们将带你探索邀请收件人调查MonkeyCollectorAP

在本文中,您将会了解到关于邀请收件人调查Monkey Collector API PHP的新资讯,同时我们还将为您解释查收邀请函的相关在本文中,我们将带你探索邀请收件人调查Monkey Collector API PHP的奥秘,分析查收邀请函的特点,并给出一些关于@atcoder - Japanese Student Championship 2019 Qualification - E@ Card Collector、Azure Monitor Data Collector API Powershell示例不起作用、C++ Battery Collector Power - 官方教程、collector的实用技巧。

本文目录一览:

邀请收件人调查Monkey Collector API PHP(查收邀请函)

邀请收件人调查Monkey Collector API PHP(查收邀请函)

如何解决邀请收件人调查Monkey Collector API PHP

我正在尝试向调查猴子中的邮件添加多个收件人。 这是我的代码:

$data = [
    [

        ''email'' => ''dsfdsfd@gmail.com'',''first_name'' => ''sdf sdfsdf'',''custom_fields'' => [
            "1" => ''20-20-2020''
        ]
    ]
];

$cURLConnection = curl_init();

curl_setopt($cURLConnection,CURLOPT_URL,''https://api.surveymonkey.com/v3/surveys/119550392/collectors/175336023/messages/'' . $message_id . ''/recipients/bulk'');
curl_setopt($cURLConnection,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($cURLConnection,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cURLConnection,CURLOPT_HTTPHEADER,$auth_data);
curl_setopt($cURLConnection,CURLOPT_POSTFIELDS,$postData);
$list = curl_exec($cURLConnection);
curl_close($cURLConnection);

由于某种原因,我收到此错误:

stdClass Object
(
    [error] => stdClass Object
        (
            [id] => 1002
            [name] => Bad Request
            [docs] => https://developer.surveymonkey.com/api/v3/#error-codes
            [message] => Invalid schema in the body provided.
            [http_status_code] => 400
        )

)

我不明白是什么问题?

谢谢

解决方法

好的,我解决了这个问题。 该数组假定在数据之前具有接触索引。

@atcoder - Japanese Student Championship 2019 Qualification - E@ Card Collector

@atcoder - Japanese Student Championship 2019 Qualification - E@ Card Collector

[toc]


@description@

N 个卡片放在 H*W 的方格图上,第 i 张卡片的权值为 Ai,放在 (Ri, Ci)。一个位置可以放置多张卡片。

你可以在每行捡起最多一张卡片,然后在每列捡起最多一张卡片。

求捡起的卡片权值最大和。

Constraints 所有值都是整数。 1≤N≤10^5, 1≤H,W≤10^5, 1≤Ai≤10^5, 1≤Ri≤H, 1≤Ci≤W。

Input 输入的形式如下: N H W R1 C1 A1 R2 C2 A2 ⋮ ⋮ RN CN AN

Output 输出可能的最大权和。

Sample Input 6 2 2 2 2 2 1 1 8 1 1 5 1 2 9 1 2 7 2 1 4 Sample Output 28

样例解释如下: 从第一行捡起第四张卡 A4。 从第二行捡起第六张卡 A6。 从第三行捡起第二张卡 A2。 从第四行捡起第五张卡 A5。 最后权值和 = A4 + A6 + A2 + A5 = 9 + 7 + 4 + 8 = 28。

@solution@

看到这个题就知道它一定是个网络流。

我们源点连向每个卡片,容量为 1,费用为权值;卡片连向它所在的行与列,容量为 1,费用为 0;每行每列向汇点连边,容量为 1,费用为 0。 这样建图跑出来的最大费用流就是答案。

观察这个建图,思考发现它总是先沿着卡片权值最大的路径尝试增广,且它的增广过程是不会撤回的(即以前增广过的卡片不会在某一次增广中被删掉)。 所以:我们可以考虑按权值从大到小加入每张卡片,判断每次加入的卡片是否能与之前的卡片共存。

考虑我们建出来的图实际上一个二分图,我们可以使用 hall 定理判定每次加入卡片后,图中是否依然存在完美匹配。 回想 hall 定理的内容:一个点集 S 的 size <= 它邻集 T 的 size,也可以写作 |T| - |S| >= 0。我们这里的点集的邻集就代表它们所在的行列集合。

我们尝试去找不满足 hall 定理的情况。 假如仅存在单独一个点,则 |T| - |S| = 1。如果加入一个与它不在同一行或同列的点,此时 |T| - |S| 会变大,与我们目的相悖;加入一个与它在同一行或同一列的点时,|T| - |S| 不变,但之后加入的点更有可能使得 |T| - |S| 变小,所以加入这个点更有可能不满足 hall 定理。 于是:我们通过找这个点集同一行同一列的所有点不断扩大点集,到无法扩大时再判断此时的 |T| - |S| 是否满足 hall 定理。

具体到实现,我们可以对行与列建并查集,并查集内统计这个行列集合含多少行多少列(即上文的 |T|)与这些行列上有多少卡片(即上文的 |S|)。 每次加入一张卡片就把它所在的行列集合通过并查集合并,同时维护一下。当然要在加入之前判断是否合法(即是否加入完这张卡片,它所在的集合会出现 |T| - |S| < 0)。

@accepted code@

#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 100000;
struct node{
	int R, C, A;
	friend bool operator < (node a, node b) {
		return a.A < b.A;
	}
}nd[MAXN + 5];
int fa[2*MAXN + 5], key[2*MAXN + 5], siz[2*MAXN + 5];
int find(int x) {
	return fa[x] = (fa[x] == x ? x : find(fa[x]));
}
int N, H, W;
int main() {
	long long ans = 0;
	scanf("%d%d%d", &N, &H, &W);
	for(int i=1;i<=H;i++) fa[i] = i, siz[i] = 1, key[i] = 0;
	for(int i=1;i<=W;i++) fa[i + H] = i + H, siz[i + H] = 1, key[i + H] = 0;
	for(int i=1;i<=N;i++)
		scanf("%d%d%d", &nd[i].R, &nd[i].C, &nd[i].A);
	sort(nd + 1, nd + N + 1);
	for(int i=N;i>=1;i--) {
		int fx = find(nd[i].R), fy = find(nd[i].C + H);
		if( fx == fy ) {
			if( siz[fx] >= key[fx] + 1 ) {
				key[fx]++;
				ans += nd[i].A;
			}
		}
		else {
			if( siz[fx] + siz[fy] >= key[fx] + key[fy] + 1 ) {
				siz[fx] += siz[fy], key[fx] += key[fy] + 1, fa[fy] = fx;
				ans += nd[i].A;
			}
		}
	}
	printf("%lld\n", ans);
}

@details@

被老师莫名其妙拉去打这种奇怪的比赛。。。

在我印象里,现在 hall 定理的题还是算比较少的吧,记下来记下来。

Azure Monitor Data Collector API Powershell示例不起作用

Azure Monitor Data Collector API Powershell示例不起作用

如何解决Azure Monitor Data Collector API Powershell示例不起作用

我尝试使用PowerShell示例https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-collector-api#powershell-sample,而没有进行任何更改。

它以状态 200 (确定)完成,并在门户网站的自定义日志(日志分析工作区->日志)中正确创建了具有LogType(Myrecordtype)的新表。 )。

但是,提交的事件不会在那里出现-始终有“最近24小时没有结果”。另外,在新表中,没有创建任何自定义属性。

有人看到过类似的问题吗? (有些人似乎正在成功使用C#代码。)谢谢!

解决方法

疯狂……第二天,所有事件都在Log Analytics工作区中显示。即使是我产生的新事件也会立即出现。

似乎只是那天的小故障。好吧,API在“预览”中……

C++ Battery Collector Power - 官方教程

C++ Battery Collector Power - 官方教程

BATTERY 思路

该篇是学习完官方实例《Battery Collector Power》的思路总结

主要是理清思路,以及过程需要注意的,以及总结

PickUp 类

PickUp 功能

  • 获取 Mesh 函数 GetPickUpMesh
  • 被搜集函数 WasCollected

PS: 这就是它作为收集类的基类的原因 , 拥有最基本的函数,扩张交给子类

PickUp 子类 - PickUp_Battery 类

自身属性

  • 电量

PickUp_Battery 功能

  • 设置物理特性
  • 重写父类函数 WasCollected

SpawnBattery 类

3W 思路

  • where 在哪里生
  • what 生什么
  • when 什么时候生

SpawnBattery 功能

  • 容器:一个立方体 BoxComponent
  • 生产:生产函数 SpawnActor----- 考虑范围
  • 控制:控制生产的函数 HandleSpawnActor

PS: 思路一一对应功能

Extend Chatactert 类

总体思路

收集什么 -> 收集电池 -> 怎么收集 -> 用 sphere 包含收集 -> 更新自身电量 -> 更新自身颜色(拓展)

扩展自身属性

  • 当前电量
  • 初始化电量
  • 自身速度
  • 受到电量影响的速度

扩展功能

  • 电池收集的函数 CollectorBattery
  • 更新电量函数 UpdatePower
  • 自身颜色更新 UpdateBodyColor 交给蓝图实现(扩展)

Extend GameModeBase 类

制定规则

  • 什么时候赢
  • 什么时候输

HUD 绘制

自身属性

  • 游戏获胜需要的电量

功能

  • 设置当前游戏状态 SetCurrentGameMode
  • 设置当前生产状态 SetCurrentSpawnState

BATTERY 实现

先大概后细节

  1. 生产电池
  2. 收集电池
  3. 更新自身电量以及速度
  4. 更新游戏模式
  5. 更新生产状态

(扩展细节)

  1. 更新自身颜色,随电量变化
  2. 收集特效
  3. 更新游戏模式细节

collector

collector

<?php set_time_limit(0); header("Content-type:text/html;charset=utf8"); /** * 采集程序类 * @author Administrator * */ class Collector { public $pages = array(); public $result = array();//结果 public $startUrls = array();//第一层链接 public $timeout = 80; public $httpContent; public $httpHead = array();//文件头 public $putHead = array();//自定底的文件头 public $fields = array();//采集的字段 public $deepth; //采集层次数 public $layout_arr;//层次结构 public $limit =0 ;//采集限制条数 public $runtime = 0;//程序运行时间 public $charset = ''UTF-8''; public $httpreferer; public $pagelimit = 0; public $filepath = ''./''; /** * 运行采集 * * @return array */ function run() { $begintime = $this->microtime_float (); $cnt = 1; foreach ( $this->startUrls as $starturl ) { /** * 解析出起始地址中的页码区间 */ if (preg_match (''~\{(\d+),(\d+)\}~'', $starturl, $pagenum )) { $pagebegin = intval ( $pagenum [1] ); $pageend = intval ( $pagenum [2] ); for(; $pagebegin <= $pageend; $pagebegin ++) { $starturl = str_replace ( $pagenum [0], $pagebegin, $starturl ); $urllists = $this->getLists ( $this->layout_arr [0] [''pattern''], $this->getContent ( $starturl ) ); foreach ( $urllists as $url ) { if (($this->limit > 0 && $cnt <= $this->limit) || $this->limit == 0) { $this->filterContent ( $this->getContent ( $url, $starturl ) ); $cnt ++; } } } } else { $urllists = $this->getLists ( $this->layout_arr [0] [''pattern''], $this->getContent ( $starturl ) ); foreach ( $urllists as $url ) { if (($this->limit > 0 && $cnt <= $this->limit) || $this->limit == 0) { $this->filterContent ( $this->getContent ( $url, $starturl ) ); $cnt ++; } } } } $this->runtime = $this->microtime_float () - $begintime; return $this->result; } /** * 从文字段中根据规则提取出url列表 * * @param string $pattern * @param string $content * @return Array */ function getLists($pattern = '''', $content = '''') { if (strpos ( $pattern, ''{*}'' ) === false) return array ( $pattern ); $pattern = preg_quote ( $pattern ); $pattern = str_replace ( ''\{\*\}'', ''([^\''\">]*)'', $pattern ); $pattern = ''~'' . $pattern . ''~is''; preg_match_all ( $pattern, $content, $preg_rs ); return array_unique ( $preg_rs [0] ); } /** * 获取指定url的html内容包括头 * * @param string $url * @return string */ function getContent($url, $referer = '''') { $url = $this->urlRtoA ( $url, $referer ); preg_match ( ''/(http:\/\/)([^:\/]*):?(\d*)(\/?.*)/i'', $url, $preg_rs ); $host = $preg_rs [2]; $port = empty ( $preg_rs [3] ) ? 80 : $preg_rs [3]; $innerUrl = $preg_rs [4]; $fsp = fsockopen ( $host, $port, $errno, $errstr, $this->timeout ); if (! $fsp) $this->log ( $errstr . ''('' . $errno . '')'' ); $output = "GET $url HTTP/1.0\r\nHost: $host\r\n"; if (! isset ( $this->putHead [''Accept''] )) $this->putHead [''Accept''] = "*/*"; if (! isset ( $this->putHead [''User-Agent''] )) $this->putHead [''User-Agent''] = ''Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2)''; if (! isset ( $this->putHead [''Refer''] )) { $this->putHead [''Refer''] = ($referer == '''') ? ''http://'' . $host : $referer; } foreach ( $this->putHead as $headname => $headvalue ) { $output .= trim ( $headname ) . '': .trim($headvalue)."\r\n"''; } $output .= "Connection: close\r\n\r\n"; fwrite ( $fsp, $output ); $content = ''''; while ( ! feof ( $fsp ) ) { $content .= fgets ( $fsp, 256 ); } fclose ( $fsp ); $this->getHead ( $content ); $this->httpContent = $content; if (strtoupper ( $this->charset ) != ''UTF-8'') { $content = iconv ( $this->charset, ''utf-8'', $content ); } else if (! empty ( $this->httpHead [''charset''] ) && $this->httpHead [''charset''] != ''UTF-8'') { $content = iconv ( $this->httpHead [''charset''], ''utf-8'', $content ); } $this->httpreferer = $referer; return $content; } /** * 按照规则从内容提取所有字段 * * @param Array * @return Array */ function filterContent($content = '''') { $rs = array (); foreach ( $this->field_arr as $field => $fieldinfo ) { $rs [$field] = $this->getPregField ( $fieldinfo, $content ); } $this->result [] = $rs; } /** * 相对路径转化为绝对路径 * * @param string $relative * @param string $referer * @return string */ function urlRtoA($relative, $referer) { /** * 去除#后面的部分 */ $pos = strpos ( $relative, ''#'' ); if ($pos > 0) $relative = substr ( $relative, 0, $pos ); /** * 检测路径如果是绝对地址直接返回 */ if (preg_match ( "~^(http|ftp)://~i", $relative )) return $relative; /** * 解析引用地址,获得协议,主机等信息 */ preg_match ( "~((http|ftp)://([^/]*)(.*/))([^/#]*)~i", $referer, $preg_rs ); $parentdir = $preg_rs [1]; $petrol = $preg_rs [2] . ''://''; $host = $preg_rs [3]; /** * 如果以/开头的情况 */ if (preg_match ( "~^/~i", $relative )) return $petrol . $host . $relative; return $parentdir . $relative; } /** * 根据规则提取一个字段 * * @param string $pattern * @param string $content * @return string */ function getPregField($fieldinfo,$content) { /** * 规则为固定值的情况,直接返回固定值 */ if(strpos($fieldinfo[''pattern''],''{''.$fieldinfo[''field''].''}'') === false) return $fieldinfo[''pattern'']; if($fieldinfo[''isregular''] == ''true''){ $pattern = $fieldinfo[''pattern'']; $pattern = str_replace(''{''.$fieldinfo[''field''].''}'',''(?P<''.$fieldinfo[''field''].''>.*?)'',$pattern); }else{ $pattern = preg_quote($fieldinfo[''pattern'']); $pattern = str_replace(''\{''.$fieldinfo[''field''].''\}'',''(?P<''.$fieldinfo[''field''].''>.*?)'',$pattern); } $pattern = "~".$pattern."~is"; preg_match($pattern,$content,$preg_rs); $fieldresult = $preg_rs[$fieldinfo[''field'']]; /** * 去掉换行符 */ $fieldresult = preg_replace("~[\r\n]*~is",'''',$fieldresult); /** * 对采集到的结果根据规则再进行二次替换处理 */ $replace_arr = $fieldinfo[''replace'']; if(is_array($replace_arr)){ $replace_arr[0] = "~".$replace_arr[0]."~s"; $fieldresult = preg_replace($replace_arr[0],$replace_arr[1],$fieldresult); } /** * 针对有下一页的字段递归采集 */ if($this->pagelimit == 0){ if($fieldinfo[''nextpage''] != ''''){ $pattern = $fieldinfo[''nextpage'']; $pattern = str_replace(''{nextpage}'',''(?P[^\''\">]*?)'',$pattern); $pattern = "~".$pattern."~is"; if(preg_match($pattern,$content,$preg_rs) && $preg_rs[''nextpage''] != ''''){ $fieldresult .= $this->getPregField($fieldinfo,$this->getContent($preg_rs[''nextpage''],$this->httpreferer)); } } } if(!empty($fieldinfo[''callback'']))$fieldresult = $fieldinfo[''callback'']($fieldresult); return $fieldresult; } /** * 添加一个采集字段和规则 * * @param string $field * @param string $pattern */ function addField($field,$pattern,$replace_arr='''',$isregular=''false'',$nextpage = '''',$callback='''') { $rs = array( ''field'' => $field, ''pattern'' => $pattern, ''replace'' => $replace_arr, ''isregular'' => $isregular, ''nextpage'' => $nextpage, ''callback''=>$callback ); $this->field_arr[$field] =$rs; } /** * 输出 */ function output() { echo "The result is:<pre>"; echo "runtime :$this->runtime S"; print_r( $this->result ); echo "</pre>"; } /** * 输出到XLS文件 * * @param string $file */ function saveXls($file = ''spider_result.xls'') { $fp = fopen ( $file, ''w'' ); if ($fp) { foreach ( $this->result as $result ) { $line = implode ( "\t", $result ) . "\n"; fputs ( $fp, $line ); } } fclose ( $fp ); echo ''The result has been saved to '' . $file . ''. Cost time:'' . $this->runtime; } function saveSql($table = ''spider_result'', $file = ''spider_result.sql'') { $fp = fopen ( $file, ''w'' ); if ($fp) { foreach ( $this->field_arr as $fieldinfo ) { $sql_key .= '', `'' . $fieldinfo [''field''] . ''`''; } $sql_key = substr ( $sql_key, 1 ); foreach ( $this->result as $result ) { $sql_value = array (); foreach ( $result as $key => $value ) { $sql_value [] = "''" . $this->addslash ( $value ) . "''"; } $line = "INSERT INTO `$table` ( $sql_key ) VALUES (" . join ( '', '', $sql_value ) . ");\r\n"; fputs ( $fp, $line ); } } fclose ( $fp ); echo ''The result has been saved to '' . $file . ''. Cost time:'' . $this->runtime; } /** * 取得响应内容的头部信息 * * @param string $content * @return array */ function getHead($content) { $head = explode("\r\n\r\n",$content); $head = $head[0]; // echo $head; if(!preg_match("~charset\=(.*)\r\n~i",$head,$preg_rs)) preg_match(''~charset=([^\"\'']*)~i'',$content,$preg_rs); $this->httpHead[''charset''] = strtoupper(trim($preg_rs[1])); // preg_match("~charset\=(.*)~i",$head,$preg_rs); return $this->httpHead; } /** * 设置采集页面的编码 * 在程序不能自动识别的情况下采集前要手动调用此函数 * * @param string $charset */ function setCharset($charset){ $this->charset = strtoupper($charset); } /** * 设置第一层链接页面地址 * * @param array $url_arr */ function setStartUrls($url_arr) { $this->startUrls = $url_arr; } /** * 增加一个第一层链接页面地址 * * @param string $url */ function addStartUrl($url) { $this->startUrls[] = $url; } /** * 添加一个采集层次 * * @param integer $deep * @param string $layout * @param boolean $isSimple * @param boolean $isPageBreak * @param string $pattern */ function addLayer($deep,$layout,$pattern = '''',$isSimple = ''false'',$isPageBreak = ''false'') { $this->layout_arr[$deep] = array( ''layout''=>$layout, ''isSimple''=>$isSimple, ''isPageBreak''=>$isPageBreak, ''pattern''=>$pattern ); } /** * 自定义head * * @param string $namespace * @param string $value */ function setHead($name, $value) { $this->putHead [$name] = $value; } /** * 清除html代码 * * @param string $content; * @param string $cleartags * @return string */ function clearHtml($content, $cleartags = ''div'') { $cleartags_arr = explode ( ''|'', $cleartags ); foreach ( $cleartags_arr as $cleartag ) { $pattern = ''~<\/?'' . $cleartag . ''[^>]*>~is''; $content = preg_replace ( $pattern, '''', $content ); } return $content; } /** * 日志 */ function log($str) { echo $str . "\n"; } /** * 获取采集运行时间 * * @return float */ function getRuntime() { return $this->runtime; } function microtime_float() { list ( $usec, $sec ) = explode ( " ", microtime () ); return (( float ) $usec + ( float ) $sec); } function addslash($string) { return addslashes ( $string ); } } ?>

今天的关于邀请收件人调查Monkey Collector API PHP查收邀请函的分享已经结束,谢谢您的关注,如果想了解更多关于@atcoder - Japanese Student Championship 2019 Qualification - E@ Card Collector、Azure Monitor Data Collector API Powershell示例不起作用、C++ Battery Collector Power - 官方教程、collector的相关知识,请在本站进行查询。

本文标签: